• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

Transaction Management Across Multiple DAOs

 
Ranch Hand
Posts: 127
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 754
Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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



You mean JPA/EJB?
 
Murat Balkan
Ranch Hand
Posts: 127
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
it is not JPA or EJB. It is implemented as POJO.
Thanks,
 
Let me tell you a story about a man named Jed. He made this tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic