2 Replies Latest reply: May 14, 2012 2:39 AM by Maciej Swiderski RSS

Strange behavior with jbpm and mysql

hansi007 Newbie

My jbpm processes are made persistent with mysql. That works fine until i want to restore a session. That always fails although the session was stored correctly in the mysql database.

That is caused by a query that wasn't created rightly by hibernate:

Hibernate: select sessioninf0_.id as id39_0_, sessioninf0_.lastModificationDate as lastModi2_39_0_, sessioninf0_.rulesByteArray as rulesByt3_39_0_, sessioninf0_.startDate as startDate39_0_, sessioninf0_.OPTLOCK as OPTLOCK39_0_ from SessionInfo sessioninf0_ where sessioninf0_.id=?


As hibernate mysql dialect i use:

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


Thanks for your help.



I am using Windows 7 with mysq 5.1.11. The error was: "java.lang.RuntimeException: Could not find session data for id <session_id>"


I hope i solved the error now:

I changed the persistence.xml from

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


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


The problem i think wasn't the "select sessioninf0_.id as id39_0_, ..." it was that with the "create" parameter all tables were cleared everytime a new process was called.

  • 1. Re: Strange behavior with jbpm and mysql
    Mauricio Salatino Master

    Ok, what's the error? can you share the stack trace? Can you let us know which version of MySQL are you using, under which operating system?


  • 2. Re: Strange behavior with jbpm and mysql
    Maciej Swiderski Master

    This is caused due to both runtime engine and bam module share the same persistence unit and if you have there ddl generation set to create it will rebuild the schema every time entity manager factory is created, meaning two time: first time when you build the session and then when the bam module is initialized for instance when you view process instances in the console.

    So your conclusion is right, setting it to update is the right setting.