JBoss Community

Re: jbpm5 Exception:Row was updated or deleted by another transaction (or unsaved-value mapping was incorrect): [org.jbpm.persistence.processinstance.ProcessInstanceInfo#2]

created by Daniel Ch in jBPM - View the full discussion

Hi,

 

I am facing the same problem and I want to provide more information.

 

My JBPM datasource:

 

<datasources>
<xa-datasource>
        <jndi-name>JbpmDS</jndi-name>
        <xa-datasource-class>oracle.jdbc.xa.client.OracleXADataSource</xa-datasource-class>
        <xa-datasource-property name="URL">jdbc:oracle:thin:@HOST:1521:SCHEMA</xa-datasource-property>
        <xa-datasource-property name="User">USER</xa-datasource-property>
        <xa-datasource-property name="Password">PASSWORD</xa-datasource-property>
        <min-pool-size>1</min-pool-size>
        <max-pool-size>5</max-pool-size>
        <idle-timeout-minutes>0</idle-timeout-minutes>
        <prepared-statement-cache-size>32</prepared-statement-cache-size> 
        <metadata>
            <type-mapping>Hypersonic SQL</type-mapping>
        </metadata> 
</xa-datasource>

    

Persistence.xml:

 

<persistence>

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

        <provider>org.hibernate.ejb.HibernatePersistence</provider>
        <jta-data-source>java:JbpmDS</jta-data-source>
        <class>org.drools.persistence.info.SessionInfo</class>
        <class>org.jbpm.persistence.processinstance.ProcessInstanceInfo</class>
        <class>org.drools.persistence.info.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.max_fetch_depth" value="3"/>
            <property name="hibernate.show_sql" value="true"/>
        </properties>
    </persistence-unit>
</persistence>

 

JBPM init process:

 

         @PersistenceUnit(name = "org.jbpm.persistence.jpa")
            private EntityManagerFactory emf;
          
          ...
 
             KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();
            org.drools.io.Resource resource = ResourceFactory.newClassPathResource("Test.bpmn");
 
            env = KnowledgeBaseFactory.newEnvironment();
            kbuilder.add(resource, ResourceType.BPMN2);
            env.set(EnvironmentName.ENTITY_MANAGER_FACTORY, emf);
            
            kbase = kbuilder.newKnowledgeBase();    
    
            session = JPAKnowledgeService.newStatefulKnowledgeSession(kbase, null, env);           
            JPAWorkingMemoryDbLogger logger = new JPAWorkingMemoryDbLogger(session);
 
            session.getWorkItemManager().registerWorkItemHandler("EjbCall", new EjbWorkItemHandler());
 

 

I want to use that single StatefulKnowledgeSession within my application (session should be threadsafe).

 

ProcessInstance instance = session.startProcess("Test.bpmn", input);

 

Thats working for one single client request. However, by starting multiple request to that single Session I will get the described error and I guess it is a threading issue. 

 

Any suggestions or remarks?

 

Cheers

Reply to this message by going to Community

Start a new discussion in jBPM at Community