2 Replies Latest reply: Jul 26, 2012 12:52 AM by new bee RSS

    problem JBPM 5 - bitronix- spring- hibernate

    cip80 Newbie

      Hi,

      Can you help me please?

      I'm trying to manage the persistence of a jBPM 5 in an application (struts2, spring3 and Hibernate3),to manage knowledge bases and configure sessions.

      1. I configured btm as transacton manager in tomcat 7 -->  http://docs.codehaus.org/display/BTM/Tomcat13.

       

      2. My spring-context.xml

       

       

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

      <beans xsi:schemaLocation="http://www.springframework.org/schema/beans

                                         http://www.springframework.org/schema/beans/spring-beans-2.5.xsd

         http://drools.org/schema/drools-spring http://drools.org/schema/drools-spring-1.3.0.xsd"

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

               xmlns="http://www.springframework.org/schema/beans"

               xmlns:jbpm="http://drools.org/schema/drools-spring"

               xmlns:drools="http://drools.org/schema/drools-spring" >

       

      <!-- Database Configuration -->

      <import resource="config/spring/DataSource.xml"/>

       

      <!-- Beans Declaration -->

                    

           <bean id="emf" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">

                <property name="persistenceUnitName" value="org.drools.persistence.jpa"/>

                <property name="persistenceXmlLocation" value="META-INF/persistence.xml"></property>

                          <property name="dataSource" ref="dataSource" />

                          <property name="jpaVendorAdapter">

                                    <bean class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter">

                                              <property name="database" value="MYSQL" />

                                              <property name="showSql" value="true" />

                                    </bean>

                          </property>

               </bean>

       

        <bean id="txManager" class="org.springframework.orm.jpa.JpaTransactionManager">

                <property name="entityManagerFactory" ref="emf"/>

               </bean>

       

         <drools:grid-node id="node1"/>

               <drools:kbase id="kbase1" node="node1">

                     <drools:resources>

                              <drools:resource type="BPMN2" source="Evaluation.bpmn"/>

                     </drools:resources>

           </drools:kbase>

            <drools:ksession id="ksession1" type="stateful" kbase="kbase1" node="node1">

                  <drools:configuration>

                       <drools:jpa-persistence>

                        <drools:transaction-manager ref="txManager"/>

                        <drools:entity-manager-factory ref="emf"/>

                       </drools:jpa-persistence>

                  </drools:configuration>

          </drools:ksession>

       

      </beans>

       

       

      3.My persistence.xml file config is

       

       

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

        <persistence version="1.0"

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

             http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd

             http://java.sun.com/xml/ns/persistence/orm

            http://java.sun.com/xml/ns/persistence/orm_1_0.xsd"

          xmlns:orm="http://java.sun.com/xml/ns/persistence/orm" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

          xmlns="http://java.sun.com/xml/ns/persistence">

       

      <persistence-unit name="org.drools.persistence.jpa"

        transaction-type="JTA">

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

             <jta-data-source>test</jta-data-source>

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

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

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

             <class>org.jbpm.process.audit.ProcessInstanceLog</class>

             <class>org.jbpm.process.audit.NodeInstanceLog</class>

             <class>org.jbpm.process.audit.VariableInstanceLog</class>

        

                <properties>

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

                    <property name="hibernate.max_fetch_depth" value="3" />

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

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

                    <property name="hibernate.transaction.manager_lookup_class"

                    value="org.hibernate.transaction.BTMTransactionManagerLookup" />

              </properties>

      </persistence-unit>

      </persistence>