cancel
Showing results for 
Search instead for 
Did you mean: 

Activiti 5.19 with Hibernate

turael
Champ in-the-making
Champ in-the-making
Hello friends of activiti,

currently I have a very strange problem - my identity tables (from activiti.h2.create.identity.sql) not exists in my h2 database (for junit testing).
I use activiti 5.19.0 and hibernate 5.1.0 in my project. Activiti is connected to a transactionManager and a sessionFactory everything works fine…


2016-04-11 13:09:58 INFO  org.activiti.engine.impl.db.DbSqlSession:1292 - performing create on engine with resource org/activiti/db/create/activiti.h2.create.engine.sql
2016-04-11 13:09:58 INFO  org.activiti.engine.impl.db.DbSqlSession:1292 - performing create on history with resource org/activiti/db/create/activiti.h2.create.history.sql
2016-04-11 13:09:58 INFO  org.activiti.engine.impl.db.DbSqlSession:1292 - performing create on identity with resource org/activiti/db/create/activiti.h2.create.identity.sql
2016-04-11 13:09:58 INFO  org.activiti.engine.impl.ProcessEngineImpl:85 - ProcessEngine default created



but if I use this property in my hibernate configuration the problem starts:
<prop key="hibernate.hbm2ddl.auto">create</prop>



2016-04-11 13:15:28 INFO  org.activiti.engine.impl.db.DbSqlSession:1292 - performing create on engine with resource org/activiti/db/create/activiti.h2.create.engine.sql
2016-04-11 13:15:28 INFO  org.activiti.engine.impl.db.DbSqlSession:1292 - performing create on history with resource org/activiti/db/create/activiti.h2.create.history.sql
2016-04-11 13:15:28 INFO  org.activiti.engine.impl.ProcessEngineImpl:85 - ProcessEngine default created


I cannot create my own tables from entities and the whole activiti db at the same time.

Does someone knows what my problem could be?
Maybe there is another solution to create own and activit tables?


greetings
Turael
3 REPLIES 3

jbarrez
Star Contributor
Star Contributor
I've never seen that issue … we also use hibernate in the commercial version … but did not encounter this.

Could it be there is a table name overlap?

turael
Champ in-the-making
Champ in-the-making
Activiti has a special namespace for the tables, while our tables dont have a namespace and the names are written in german - so i can exclude an overlaping problem Smiley Sad

Maybere there are a configuration problem? But its mostly the default configuration from the guide…(execpt the sessionFactory)

<code>
<bean id="dataSource"
  class="org.springframework.jdbc.datasource.SimpleDriverDataSource">
  <property name="driverClass" value="org.h2.Driver" />
  <property name="url" value="jdbc:h2:tcp://localhost/~/activiti" />
  <property name="username" value="sa" />
  <property name="password" value="" />
</bean>

<!– Hibernate Transaction Manager Definition –>
<bean id="transactionManager"
  class="org.springframework.orm.hibernate5.HibernateTransactionManager">
  <property name="sessionFactory" ref="sessionFactory" />
  <property name="dataSource" ref="dataSource" />
</bean>

<!– Hibernate Session Factory –>
<bean id="sessionFactory"
  class="org.springframework.orm.hibernate5.LocalSessionFactoryBean">
  <property name="dataSource" ref="dataSource" />
  <property name="packagesToScan" value="de.custom.db.model" />
  <property name="hibernateProperties">
   <props>
    <prop key="hibernate.dialect">org.hibernate.dialect.H2Dialect</prop>
    <prop key="hibernate.show_sql">false</prop>
    <prop key="hibernate.format_sql">true</prop>
    <prop key="hibernate.generate_statistics">false</prop>
    <!–  <prop key="hibernate.hbm2ddl.auto">create</prop> –>
   </props>
  </property>
</bean>

<bean id="processEngineConfiguration" class="org.activiti.spring.SpringProcessEngineConfiguration">
  <property name="transactionManager" ref="transactionManager" />
  <property name="databaseSchemaUpdate" value="true" />
  <property name="jobExecutorActivate" value="true" />

  <property name="asyncExecutorEnabled" value="true" />
  <property name="asyncExecutorActivate" value="true" />

  <property name="databaseType" value="h2" />
  <property name="history" value="full" />

  <property name="mailServerHost" value="localhost" />
  <property name="mailServerPort" value="25" />
</bean>

</code>

jbarrez
Star Contributor
Star Contributor
That config looks ok at a quick glance … nothing odd there.
I agree an overlap is odd, yet … it's the only way (looking at the code) I can see it being skipped.

Does your jdbc user have maybe access to more than one schema? Maybe it's reading from a different schema?