• Post Reply Bookmark Topic Watch Topic
  • New Topic

EJB3 noob and User Managed Transaction

 
Jorge Bendahan
Ranch Hand
Posts: 82
  • Mark post as helpful
  • send pies
  • 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.
 
Jaikiran Pai
Sheriff
Posts: 10447
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
  • 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
  • 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??
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!