IBM WSAD sessionContext.setRollbackOnly roll back issues

Discussions

EJB design: IBM WSAD sessionContext.setRollbackOnly roll back issues

  1. Hi All,

    I have deployed 2 ejbs (EJB1 and EJB2) with RequiresNew transaction attributes in IBM WSAD 5.1. The reis one method process() in EJB1 which internally calls a POJO. This POJO calls the executeLogic() method in EJB2 which performs a database insert and database update using Hibernate. Upon returning successfully from EJB2.executeLogic(), the POJO throws an exception.

    This exception is caught by EJB1 and sessionCOntext.setRollbackOnly() is called. Unfortunately, this rolls back the entries posted by EJB2. Ideally I believe this should not happen because they both are deployed with RequiresNew transaction attributes for all methods.

    Can anyone help me with this issue ? Please respond. Thanx.

    Regards,
    Sumukh.
  2. I guess, the Transaction context of the session bean doesn't get propagated to the hibernate's transaction and hibernate might start its own transaction suspending the session bean's transaction.
    Not sure though, Check the hibernate documentation.