jQuery in Action, 3rd edition
The moose likes JDBC and Relational Databases and the fly likes Transaction Management Across Multiple DAOs Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Building Microservices this week in the Design forum!
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "Transaction Management Across Multiple DAOs" Watch "Transaction Management Across Multiple DAOs" New topic
Author

Transaction Management Across Multiple DAOs

Murat Balkan
Ranch Hand

Joined: Sep 10, 2002
Posts: 127
Hi,
I am working on an application where I have 2 DAOs:
CustomerDAO and SubscriptionDAO. I am using pure JDBC within those daos. A manager SLSB creates and call CRUD methods on these DAOs.
In the scenario, whenever a new Customer is created, I need to create a Subscription automatically. (giving the customer id to the subscription)
I do this like this:

...
int id=customerdao.insert(customerVO);
...
subscriptionVO.customerid=id;
subscriptionDAO.insert(subscriptionvo);

I wonder how can I include transactional capabilities to this code. (If I use Tomcat alone, or Tomcat with an AS I havent decided yet).
That is to say, if theres a problem in the subscription insert section, customerdao.insert should be rollbacked.

Thank you for your help,
Murat
Hebert Coelho
Ranch Hand

Joined: Jul 14, 2010
Posts: 754

Murat Balkan wrote:I wonder how can I include transactional capabilities to this code.


You mean JPA/EJB?


[uaiHebert.com] [Full WebApplication JSF EJB JPA JAAS with source code to download] One Table Per SubClass [Web/JSF]
Murat Balkan
Ranch Hand

Joined: Sep 10, 2002
Posts: 127
Hi,
it is not JPA or EJB. It is implemented as POJO.
Thanks,
 
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com
 
subject: Transaction Management Across Multiple DAOs
 
It's not a secret anymore!