On Sep 29, 2008, at 8:39 AM, Glauber Ferreira wrote:

Hi all.

I need to rollback transactions in order to revert all data modified
(deleted, updated, created) by my tests. How can I do that in the test code
listed in this link:
http://openejb.apache.org/3.0/unit-testing-transactions.html

Suggestions in this thread are pretty good. A couple additional possibilities to throw on the stack.. If you throw a runtime exception from the TransactionBean call method the container will rollback the transaction. Another option is to call the setRollbackOnly() method on the javax.ejb.SessionContext object. A session ejb can have it injected with a field declared like "@Resource SessionContext sessionContext;"

-David

Reply via email to