File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes EJB Certification (SCBCD/OCPJBCD) and the fly likes What does the UserTransaction.rollback() do??!! Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » EJB Certification (SCBCD/OCPJBCD)
Bookmark "What does the UserTransaction.rollback() do??!!" Watch "What does the UserTransaction.rollback() do??!!" New topic

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

Pham Huy Anh
Ranch Hand

Joined: Aug 23, 2006
Posts: 41

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.

I agree. Here's the link:
subject: What does the UserTransaction.rollback() do??!!
It's not a secret anymore!