• 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
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Bear Bibeault
  • Henry Wong
  • Devaka Cooray
Saloon Keepers:
  • salvin francis
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Frits Walraven
Bartenders:
  • Jj Roberts
  • Carey Brown
  • Scott Selikoff

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??
 
Could you hold this puppy for a sec? I need to adjust this tiny ad:
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic