• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

EJB3 noob and User Managed Transaction

 
Ranch Hand
Posts: 82
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all, i'm a noob in ejb in general, i'm trying to use transactions. I have the following code:
But in the end, the transaction is not working, i mean, the insert works, but it's not an atomic transaction.
 
Sheriff
Posts: 10445
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What you are trying is bean managed transaction where the transaction commit, rollback etc... is managed by your code. You don't have to do that (although it's an option). You can use Container Managed Transactions with EJBs and leave the transaction management to the container.

Jorge Bendahan wrote:But in the end, the transaction is not working, i mean, the insert works, but it's not an atomic transaction.



Sorry, i did not understand that. Can you please explain?
 
Jorge Bendahan
Ranch Hand
Posts: 82
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Jaikiran, thanks for the reply. I Posted bad code, forget about the previous examples. This is what i want to do:


So from another class i can do something like this
But it doesnt work. I think i need to "tell" the UserTransaction instance that the insert is inside the transaction. Am i right? or is it something else??
 
Live ordinary life in an extraordinary way. Details embedded in this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic