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

    EJB CMP problem with Hibernate

    jjmargon Newbie

      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 >
       <!-- 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>

      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.