aspose file tools*
The moose likes Object Relational Mapping and the fly likes Best way of Using Transaction Support Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "Best way of Using Transaction Support" Watch "Best way of Using Transaction Support" New topic
Author

Best way of Using Transaction Support

Ravi Kiran Va
Ranch Hand

Joined: Apr 18, 2009
Posts: 2234

Hi ,

Please tell tme know what is the best way if one needs a Transaction Support :

For example if my requiremnet is to persist the User Submitted Data into the DataBase .

1. Shall i use TransactionAttribute(Required) on the BusinessService Method ??

Or

2. should i use EntityManager Transaction Suppourt

em.getTransaction().begin();

createEmployee("Ravi","Kiran",15000);

em.getTransaction().commit();


Please let me know what is the best choice ??

Save India From Corruption - Anna Hazare.
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17249
    
    6

I don't normally drink beer, but when I do. I prefer Dos XX.

Sorry, I prefer using a Transaction manager and not use .beginTransaction() commit() and rollback() because I get to put my transaction demarkation at the best level/tier that it should be set at. The service layer. My Use Cases are what I need transactional, the whole Use Case, and be done when the use case finishes. Since the Service Layer is where I start and stop my use cases, it is the perfect candidate to demark my transaction boundaries.

Mark


Perfect World Programming, LLC - Two Laptop Bag - Tube Organizer
How to Ask Questions the Smart Way FAQ
Ravi Kiran Va
Ranch Hand

Joined: Apr 18, 2009
Posts: 2234

Thank you Mark . I also planned to use Method level transactions .

I don't normally drink beer, but when I do. I prefer Dos XX.
but what is this line ?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Best way of Using Transaction Support
 
Similar Threads
With respect to using CMT Transactions in SessionBeans and Hibernate
Getting transaction
RMI and Transactions
Unable to catch StaleObjectStateException. EJB exception doesn't wrap it.
EntityTransaction.begin(); and EntityTransaction.commit();