1 Reply Latest reply on Aug 30, 2005 4:43 AM by jjmargon

    EJB CMP problem with Hibernate

      Hi, all.
      I have an application with JBoss 4.0.2 with Hibernate 3 and Jbpm 3. Also, the application has an EJB to give remote access to the application.
      The issue is that my first intention was to have a CMT EJB.
      In this way, my application didn't have any persistent code (no transaction was started , commited or rollbacked).
      The method only gets a JbpmSession (a Jbpm object that wraps an Hibernate Session object) and closes it at its end.
      On the other hand, the ejb-jar.xml has the next code

      <?xml version="1.0" encoding="UTF-8"?>
      
      <!DOCTYPE ejb-jar PUBLIC "-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN" "http://java.sun.com/dtd/ejb-jar_2_0.dtd">
      
      <ejb-jar >
      
       <enterprise-beans>
      
       <!-- Session Beans -->
       <session >
       <description>EJB Gateway entre la aplicación stand-alone SWING de Savia y la interfaz de reglas de negocio de la Web del Funcionario</description>
       <display-name>WorkFlow</display-name>
      
       <ejb-name>WorkFlow</ejb-name>
      
       <home>org.ildefe.ejb.interfaces.WorkFlowHome</home>
       <remote>org.ildefe.ejb.interfaces.WorkFlow</remote>
       <local-home>org.ildefe.ejb.interfaces.WorkFlowLocalHome</local-home>
       <local>org.ildefe.ejb.interfaces.WorkFlowLocal</local>
       <ejb-class>org.ildefe.ejb.impl.WorkFlowSession</ejb-class>
       <session-type>Stateless</session-type>
       <transaction-type>Container</transaction-type>
      
       </session>
      
       </enterprise-beans>
      
       <assembly-descriptor>
       <container-transaction>
       <method>
       <ejb-name>WorkFlow</ejb-name>
       <method-name>*</method-name>
       </method>
       <trans-attribute>Required</trans-attribute>
       </container-transaction>
       </assembly-descriptor>
      
      </ejb-jar>
      

      But, when I executed a method that writes data in the DB, the method works well (no exception is thrown and the return value is correct), but NO COMMIT was executed by the container on the DB ,i.e., the data was not persisted in the DB.
      So, I had to change to BMP instead CMP.
      In the new EJB the data is persisted (in the code, I begin the transaction and commit the transaction).
      Why doesn't CMP work well?
      Thanks in advance to any comment.
      Bye.