This week's book giveaway is in the Beginning Java forum.
We're giving away four copies of Learn Java with Math: Using Fun Projects and Games and have Ron Dai on-line!
See this thread for details.
Win a copy of Learn Java with Math: Using Fun Projects and Games this week in the Beginning Java forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Bear Bibeault
  • Junilu Lacar
  • Martin Vashko
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Scott Selikoff
  • salvin francis
  • Piet Souris

Best way of Using Transaction Support

 
Ranch Hand
Posts: 2234
Eclipse IDE Firefox Browser Redhat
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ??
 
ranger
Posts: 17344
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Ravi Kiran Va
Ranch Hand
Posts: 2234
Eclipse IDE Firefox Browser Redhat
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ?
 
A day job? In an office? My worst nightmare! Comfort me tiny ad!
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!