Win a copy of Kubernetes in Action this week in the Cloud/Virtualization forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

What does the UserTransaction.rollback() do??!!  RSS feed

Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

I am studying Transaction management in EJB. I have read through almost all the stuff life : CMT, BMT , ACID, JTS, JTA, blabla... And after several hours of practice, I am still confusing.

Well, first of all, it is very difficult to find a real demonstration of UserTransaction.rollback(). Even from Sun, they just gave us some pseudo code like :

I try the code myself and it was useless because after rollback, things are not rolled back, for both local and instance variable which are modified after ut.begin().

Secondly, considering this case:

I see this case as nested transaction and I know that container doesn't support it. But my question is: Can the rollback statement rollback the Customer data as if it has never been affected?

Similarly, I don't know what other methods like commit, setRollbackOnly really do to the object instances, variables ..ect..

That's all about my concern. By the way, if anyone know good sample of transaction managment with EJB (the real working code, not bothersome theory ), please tell me.

  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!