2 Replies Latest reply on Dec 28, 2012 4:15 PM by doboss

    jbpm 5.4 web app with JAP2

    Kamlesh Patel Newbie

      HI

       

      I am trying to run simple web application in jboss as7.

      below is my persistance.xml file

       

      <persistence-unit name="org.jbpm.persistence.jpa" transaction-type="JTA">

              <provider>org.hibernate.ejb.HibernatePersistence</provider>

              <jta-data-source>java:jboss/datasources/DemoDS</jta-data-source>

              <mapping-file>META-INF/JBPMorm.xml</mapping-file>

             <mapping-file>META-INF/ProcessInstanceInfo.hbm.xml</mapping-file>

             

              <class>org.drools.persistence.info.SessionInfo</class>

              <class>org.jbpm.persistence.processinstance.ProcessInstanceInfo</class>

              <class>org.drools.persistence.info.WorkItemInfo</class>

       

              <properties>

                  <property name="hibernate.dialect" value="org.hibernate.dialect.MySQLDialect" />

                  <!-- property name="hibernate.show_sql" value="true" /> -->

                  <property name="hibernate.hbm2ddl.auto" value="create" />

                  <property name="hibernate.jdbc.use_streams_for_binary" value="true" />

                  <property name="hibernate.transaction.manager_lookup_class" value="org.hibernate.transaction.JBossTransactionManagerLookup" />

                  <!--   property name="hibernate.transaction.jta.platform" value="org.hibernate.service.jta.platform.internal.BitronixJtaPlatform" /-->

                  <!--  property name="hibernate.transaction.manager_lookup_class" value="org.hibernate.transaction.BTMTransactionManagerLookup"/ -->

              </properties>

          </persistence-unit>

       

      If I add this line

      <mapping-file>META-INF/ProcessInstanceInfo.hbm.xml</mapping-file>

      I got following errors.

       

      Caused by: org.hibernate.DuplicateMappingException: Duplicate collection role mapping org.jbpm.persistence.processinstance.ProcessInstanceInfo.eventTypes

                      at org.hibernate.cfg.Configuration$MappingsImpl.addCollection(Configuration.java:2582)

                      at org.hibernate.cfg.HbmBinder.createClassProperties(HbmBinder.java:2139)

       

      I remove this line it give me following error

       

      2012-06-19 16:47:59,278 ERROR [org.drools.persistence.SingleSessionCommandService] - <Could not commit session> java.lang.IllegalArgumentException: Unknown entity: org.jbpm.persistence.processinstance.ProcessInstanceInfo

          at org.hibernate.ejb.AbstractEntityManagerImpl.persist(AbstractEntityManagerImpl.java:223)

          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

       

      Please suggest what should I use.

      Thanks

        • 1. Re: jbpm 5.4 web app with JAP2
          Kamlesh Patel Newbie

          HI

          I have solved issue as per this post https://community.jboss.org/message/739144#739144

           

          Here is my jbpmorm.xml file ( jpa2)

           

          <?xml version="1.0" encoding="UTF-8"?>

          <entity-mappings xmlns="http://java.sun.com/xml/ns/persistence/orm"

                           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

                           xsi:schemaLocation="http://java.sun.com/xml/ns/persistence/orm orm_2_0.xsd"

                           version="2.0">

                <named-query name="ProcessInstancesWaitingForEvent">

                    <query>

          select

              processInstanceInfo.processInstanceId

          from

              org.jbpm.persistence.processinstance.ProcessInstanceInfo processInstanceInfo join processInstanceInfo.eventTypes eventTypes

          where

              eventTypes = :type

              

                    </query>

                </named-query>

               

                  <!-- ProcessInstanceInfo mapping (needed for JPA 2) -->

               

                <entity class="org.jbpm.persistence.processinstance.ProcessInstanceInfo"

                        metadata-complete="true">

                  <pre-update method-name="update" />

                  <attributes>

                      <id name="processInstanceId">

                          <column name="InstanceId" />

                          <generated-value strategy="AUTO"/>

                      </id>

                      <basic name="processId" access="FIELD" />

                      <basic name="startDate" access="FIELD" >

                          <temporal>DATE</temporal>

                      </basic>

                      <basic name="lastReadDate" access="FIELD" >

                          <temporal>DATE</temporal>

                      </basic>

                      <basic name="lastModificationDate" access="FIELD" >

                          <temporal>DATE</temporal>

                      </basic>

                      <basic name="state" access="FIELD" />

                      <basic name="processInstanceByteArray" access="FIELD" >

                          <lob/>

                      </basic>

                      <version name="version" access="FIELD" >

                          <column name="OPTLOCK" />

                      </version>

                      <element-collection name="eventTypes" target-class="java.lang.String" access="FIELD" >

                          <collection-table name="EventTypes">

                              <join-column name="InstanceId"/>

                          </collection-table>

                      </element-collection>

                      <transient name="processInstance" />

                      <transient name="env" />

                      <transient name="id" />

                  </attributes>

                </entity>

               

                <entity class="org.drools.persistence.info.SessionInfo" metadata-complete="false">

                     <attributes>

                      <id name="id">

                          <column name="id" />

                          <generated-value strategy="IDENTITY"></generated-value>

                      </id>

                    </attributes>

                  </entity>

               

          </entity-mappings>

          • 2. Re: jbpm 5.4 web app with JAP2
            doboss Newbie

            I think you can get the correct persistence.xml from the db directory in the jbpm-installed. If you look in there you will see jbpm-persistence-JPA2.xml and task-persistence-JPA2.xml.