users@glassfish.java.net

Re: Trouble with transactions

From: <forums_at_java.net>
Date: Wed, 25 May 2011 10:55:04 -0500 (CDT)

Thanks.  I've now read a little bit on this.  Let me know if I'm doing it
right.

Outside the class I put:
@TransactionAttribute(TransactionAttributeType.REQUIRED)

In front of each method that is read only I put:
@TransactionAttribute(TransactionAttributeType.SUPPORTED)

At the top of the class I have:  @Resource  EJBContext ejbContext;

And anywhere I am throwing an application exception I preceed the throw
statement with:  ejbContext.setRollbackOnly();


--
[Message sent by forum member 'eialbur']
View Post: http://forums.java.net/node/805914