[jboss-user] [EJB 3.0] - Transactions Rollback

marook do-not-reply at jboss.com
Sun Oct 1 14:48:42 EDT 2006


Hello Experts,

I've got a problem with the rollback of failed transactions. My situation is as follows:


  | @Stateless
  | @Local
  | public class BeanA implements IBeanA{
  | 
  |         @PersistenceContext(name="MyContext")
  |         private EntityManager entityManager;
  | 
  |         public void persistSomething() {
  |                 entityManager.persist(new MyEntityBean());
  |         }
  | }
  | 


  | @Stateless
  | @Remote
  | public class BeanB implements IBeanB{
  | 
  |         @EJB
  |         private IBeanA beanA;
  | 
  |         public void doSomething() {
  |                 beanA.persistSomething();
  | 
  |                 throw new RuntimeException();
  |         }
  | }
  | 

The persistSomething and the doSomething methods are part of my business interfaces.

My problem is, that the persisted entity bean isen't rolled back from the database after the RuntimeException.
I've even tried to set the beanA's business method to TransactionAttributeType.MANDATORY so I can make sure that I'm always in the same transaction.

Do I understand the EJB 3.0 transaction model wrong? I thought as long as my transaction spreads over one thread, then all the changes are rolled back.

Do I need application transactions in this case?


Thanks in advances

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3975360#3975360

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3975360



More information about the jboss-user mailing list