Transaction rollback failure


EJB programming & troubleshooting: Transaction rollback failure

  1. Transaction rollback failure (5 messages)

    Hi! ,

    I'm developing an application in which I have a method in a session bean where I create instances of two differents Entity beans, finding by PK. I do some updates for both, and intentionally, I throw an exception in the ejbStore method of the Entity bean that a found last. I hope that occurs an rollback of the transaction, but the changes made in the first entity bean not rolled back !.

    I revised the transaction attributes in the deployment descriptor, and they are correctly, somebody knows what is wrong ??


    Threaded Messages (5)

  2. As I know the only exception that
    can roll back the transaction is system one.
    So be sure that you throw SystemException
    or rollback transaction manually
  3. Transaction rollback failure[ Go to top ]

    You can throw a system exception by e.g. throwing an EJBException (which is a RuntimeException, which means that you don't have to declare it in the method signature). Also make sure that the transaction attributes of all beans are set to (for example) REQUIRED, so that all the beans definitely participate in the same transaction.

    Pietari Laurila
  4. Transaction rollback failure[ Go to top ]


    I would not recommend throwing one unless you have a system problem you can not recover from.

    If you throw an System Exception the bean throwing the exception gets destroyed without its ejbRemove being called.

    Chapter 18 in the EJB2.0 spec talks about exceptions.

  5. Transaction rollback failure[ Go to top ]


    I have the same problem as Adrian, so if you suggest not to throw system exception, what will you do to rollback the transaction?

    Thank you,

  6. Transaction rollback failure[ Go to top ]