0 Replies Latest reply on May 3, 2006 11:38 AM by pongsor

    Transaction Demarcation on Stateful Session Bean

    pongsor Newbie


      I have a simple stateful session bean, which have several methods calling CMP beans and some direct database objects. My problem is the the transaction seems to be committed every invocation of the session bean. I think the transaction must be alive during the instance of session bean is alive but the situation is each transactions are provided for each invocation. The source codes and configuration is as follows:

      1. the session bean

      public class ProcessManagerBean implements javax.ejb.SessionBean, SessionSynchronization, ProcessManagerRemote{
       //process initialization, execution
       public String initializeProcess(String processDefinition, String instanceName) throws RemoteException{...}
       public String initializeProcess(String processDefinition) throws RemoteException{...}
       public void executeProcess(String instanceId) throws RemoteException{...}
       public void executeProcessByWorkitem(String instanceId, ResultPayload resultPayload) throws RemoteException{....}

      2. ejb-jar.xml

      3. client JSP
       InitialContext context = new InitialContext();
       ProcessManagerHomeRemote pmh = (ProcessManagerHomeRemote)context.lookup("ProcessManagerHomeRemote");
       ProcessManagerRemote pm = pmh.create();
       pid = pm.initializeProcess(pd);

      Also, when I have tried "UserTransaction", the transaction persisted properly. but finally the TransactionManager failed to commit because the client JSP have already committed the transaction. Exception "No Transaction" have occurred.

      Did I have mistake any of configuration? How do I solve this problem...