[rules-users] Rule flow persistence MY SQL

sony.john at kie.com.sg sony.john at kie.com.sg
Thu Aug 5 05:49:22 EDT 2010


Hi ,
Iam trying to persistence drools workflow using my sql as back end . But
iam getting "Could not commit sessions"
Iam trying with example code,

drool.session.conf file contains
drools.workItemHandlers = MyWorkItemHandlers.conf
#drools.commandService =
org.drools.persistence.session.SingleSessionCommandService
#drools.processInstanceManagerFactory =
org.drools.persistence.processinstance.JPAProcessInstanceManagerFactory
#drools.workItemManagerFactory =
org.drools.persistence.processinstance.JPAWorkItemManagerFactory
#drools.processSignalManagerFactory =
org.drools.persistence.processinstance.JPASignalManagerFactory
Folllwoing are my rf file

My RF file
<?xml version="1.0" encoding="UTF-8"?>
<process xmlns="http://drools.org/drools-5.0/process"
         xmlns:xs="http://www.w3.org/2001/XMLSchema-instance"
         xs:schemaLocation="http://drools.org/drools-5.0/process
drools-processes-5.0.xsd"
         type="RuleFlow" name="droolsflow"
id="org.plugtree.labs.droolsflow" package-name="org.plugtree.labs" >

  <header>
    <imports>
      <import name="org.kie.lab.variablepersistence.MyEntity" />
      <import name="org.kie.lab.variablepersistence.MyVariableSerializable"
/>
    </imports>
    <variables>
      <variable name="x" >
        <type
name="org.drools.process.core.datatype.impl.type.StringDataType" />
      </variable>
      <variable name="y" >
        <type
name="org.drools.process.core.datatype.impl.type.ObjectDataType"
className="org.kie.lab.variablepersistence.MyEntity" />
      </variable>
      <variable name="z" >
        <type
name="org.drools.process.core.datatype.impl.type.ObjectDataType"
className="org.kie.lab.variablepersistence.MyVariableSerializable" />
      </variable>
      <variable name="a" >
        <type
name="org.drools.process.core.datatype.impl.type.StringDataType" />
      </variable>
      <variable name="b" >
        <type
name="org.drools.process.core.datatype.impl.type.ObjectDataType"
className="org.kie.lab.variablepersistence.MyEntity" />
      </variable>
      <variable name="c" >
        <type
name="org.drools.process.core.datatype.impl.type.ObjectDataType"
className="org.kie.lab.variablepersistence.MyVariableSerializable" />
      </variable>
    </variables>
  </header>

  <nodes>
    <humanTask id="4" name="Human Task" x="208" y="16" width="93"
height="48" >
      <work name="Human Task" >
        <parameter name="ActorId" >
          <type
name="org.drools.process.core.datatype.impl.type.StringDataType" />
        </parameter>
        <parameter name="Comment" >
          <type
name="org.drools.process.core.datatype.impl.type.StringDataType" />
        </parameter>
        <parameter name="Content" >
          <type
name="org.drools.process.core.datatype.impl.type.StringDataType" />
        </parameter>
        <parameter name="Priority" >
          <type
name="org.drools.process.core.datatype.impl.type.StringDataType" />
        </parameter>
        <parameter name="Skippable" >
          <type
name="org.drools.process.core.datatype.impl.type.StringDataType" />
        </parameter>
        <parameter name="TaskName" >
          <type
name="org.drools.process.core.datatype.impl.type.StringDataType" />
        </parameter>
      </work>
    </humanTask>
    <humanTask id="9" name="Human Task" x="713" y="16" width="100"
height="48" >
      <work name="Human Task" >
        <parameter name="ActorId" >
          <type
name="org.drools.process.core.datatype.impl.type.StringDataType" />
        </parameter>
        <parameter name="Comment" >
          <type
name="org.drools.process.core.datatype.impl.type.StringDataType" />
        </parameter>
        <parameter name="Content" >
          <type
name="org.drools.process.core.datatype.impl.type.StringDataType" />
        </parameter>
        <parameter name="Priority" >
          <type
name="org.drools.process.core.datatype.impl.type.StringDataType" />
        </parameter>
        <parameter name="Skippable" >
          <type
name="org.drools.process.core.datatype.impl.type.StringDataType" />
        </parameter>
        <parameter name="TaskName" >
          <type
name="org.drools.process.core.datatype.impl.type.StringDataType" />
        </parameter>
      </work>
    </humanTask>
    <actionNode id="8" name="Action" x="601" y="20" width="80" height="40"
>
        <action type="expression" dialect="java" >System.out.println("x = "
+ x);
System.out.println("y = " + y);
System.out.println("z = " + z);
System.out.println("a = " + a);
System.out.println("b = " + b);
System.out.println("c = " + c);
kcontext.setVariable("a", "Some changed String");
kcontext.setVariable("b", new MyEntity("This is a changed test Entity"));
kcontext.setVariable("c", new MyVariableSerializable("This is a changed
test SerializableObject"));</action>
    </actionNode>
    <actionNode id="6" name="Action" x="333" y="20" width="80" height="40"
>
        <action type="expression" dialect="java" >System.out.println("x = "
+ x);
System.out.println("y = " + y);
System.out.println("z = " + z);
kcontext.setVariable("a", "Some new String");
kcontext.setVariable("b", new MyEntity("This is a new test Entity"));
kcontext.setVariable("c", new MyVariableSerializable("This is a new test
SerializableObject"));</action>
    </actionNode>
    <start id="1" name="Start" x="16" y="16" width="48" height="48" />
    <end id="3" name="End" x="957" y="16" width="48" height="48" />
    <actionNode id="10" name="Action" x="845" y="16" width="80" height="48"
>
        <action type="expression" dialect="java" >System.out.println("x = "
+ x);
System.out.println("y = " + y);
System.out.println("z = " + z);
System.out.println("a = " + a);
System.out.println("b = " + b);
System.out.println("c = " + c);</action>
    </actionNode>
    <humanTask id="7" name="Human Task" x="445" y="20" width="124"
height="40" >
      <work name="Human Task" >
        <parameter name="ActorId" >
          <type
name="org.drools.process.core.datatype.impl.type.StringDataType" />
        </parameter>
        <parameter name="Comment" >
          <type
name="org.drools.process.core.datatype.impl.type.StringDataType" />
        </parameter>
        <parameter name="Content" >
          <type
name="org.drools.process.core.datatype.impl.type.StringDataType" />
        </parameter>
        <parameter name="Priority" >
          <type
name="org.drools.process.core.datatype.impl.type.StringDataType" />
        </parameter>
        <parameter name="Skippable" >
          <type
name="org.drools.process.core.datatype.impl.type.StringDataType" />
        </parameter>
        <parameter name="TaskName" >
          <type
name="org.drools.process.core.datatype.impl.type.StringDataType" />
        </parameter>
      </work>
    </humanTask>
    <actionNode id="5" name="Action" x="96" y="20" width="80" height="40" >
        <action type="expression" dialect="java" >System.out.println("x = "
+ x);
System.out.println("y = " + y);
System.out.println("z = " + z);</action>
    </actionNode>
  </nodes>

  <connections>
    <connection from="5" to="4" />
    <connection from="8" to="9" />
    <connection from="7" to="8" />
    <connection from="4" to="6" />
    <connection from="10" to="3" />
    <connection from="9" to="10" />
    <connection from="6" to="7" />
    <connection from="1" to="5" />
  </connections>

</process>
persistence.xml
<?xml version="1.0" encoding="UTF-8"?>
<persistence version="1.0" xmlns="http://java.sun.com/xml/ns/persistence"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence
http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd">
   <persistence-unit name="org.drools.persistence.jpa"
transaction-type="JTA">
    <provider>org.hibernate.ejb.HibernatePersistence</provider>
    <jta-data-source>jdbc/testDS1</jta-data-source>
    <class>org.drools.persistence.session.SessionInfo</class>

<class>org.drools.persistence.processinstance.ProcessInstanceInfo</class>
    <class>org.drools.persistence.processinstance.WorkItemInfo</class>

<class>org.drools.persistence.processinstance.variabletypes.VariableInstanceInfo</class>

<class>org.drools.persistence.processinstance.variabletypes.JPAPersistedVariable</class>


<class>org.drools.persistence.processinstance.variabletypes.SerializablePersistedVariable</class>
    <class>org.kie.lab.variablepersistence.MyEntity</class>
    <class>org.kie.lab.variablepersistence.StringPersistedVariable</class>
     <class>org.kie.lab.variablepersistence.MyVariableSerializable</class>
    <properties>
        <property name="hibernate.dialect"
value="org.hibernate.dialect.MySQL5Dialect"/>
      <property name="hibernate.hbm2ddl.auto" value="create-drop"/>

      <property name="hibernate.show_sql" value="false"/>
      <property name="hibernate.connection.autocommit" value="false"/>
      <property name="hibernate.transaction.manager_lookup_class"
value="org.hibernate.transaction.BTMTransactionManagerLookup"/>
    </properties>
  </persistence-unit>
</persistence>

Information in this e-mail is intended solely for the person(s) to whom it is addressed and may contain confidential information. If you are not the intended recipient, please notify the sender and delete this e-mail message and any other record of it from your system immediately. You should not disclose or disseminate the information to any person, use it for any purpose or store or copy the information in any form or manner.  



More information about the rules-users mailing list