Hi
I'm currently using JBPM with persistance (through hibernate) with my own web app that uses its own hibernate db access (Both writes to different db schemas). Everything works fine except that when JBPM initialises its hibernate database, it copies my own hibernate table classes into its own database.
I've configured my hibernate access i.e. something like
Code:
private static SessionFactory buildSessionFactory() {
try {
// Create the SessionFactory from hibernate.cfg.xml
Configuration c = new Configuration();
c.configure("wwwhibernate.cfg.xml");
c.addAnnotatedClass(tab1.class);
c.addAnnotatedClass(tab2.class);
return c.buildSessionFactory();
} catch (Throwable ex) {
// Make sure you log the exception, as it might be swallowed
System.err.println("Initial SessionFactory creation failed." + ex);
throw new ExceptionInInitializerError(ex);
}
}
The JBPM hibernate initialises much later using persistence.xml and orm.xml
i.e.
Code:
<?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.jbpm.persistence.jpa" transaction-type="JTA">
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<jta-data-source>jdbc/testDS1</jta-data-source>
<mapping-file>META-INF/orm.xml</mapping-file>
<class>org.drools.persistence.info.SessionInfo</class>
<class>org.jbpm.persistence.processinstance.ProcessInstanceInfo</class>
<class>org.jbpm.persistence.processinstance.ProcessInstanceEventInfo</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>
<class>org.jbpm.task.Task</class>
<class>org.jbpm.task.Comment</class>
<class>org.jbpm.task.Attachment</class>
<class>org.jbpm.task.I18NText</class>
<class>org.jbpm.task.SubTasksStrategy</class>
<class>org.jbpm.task.Deadline</class>
<class>org.jbpm.task.Escalation</class>
<class>org.jbpm.task.Reassignment</class>
<class>org.jbpm.task.Notification</class>
<class>org.jbpm.task.BooleanExpression</class>
<class>org.jbpm.task.User</class>
<class>org.jbpm.task.PeopleAssignments</class>
<properties>
<property name="hibernate.dialect" value="org.hibernate.dialect.MySQL5InnoDBDialect"/>
<property name="hibernate.connection.autocommit" value="false"/>
<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-unit name="org.jbpm.task">
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<class>org.jbpm.task.Attachment</class>
<class>org.jbpm.task.Content</class>
<class>org.jbpm.task.BooleanExpression</class>
<class>org.jbpm.task.Comment</class>
<class>org.jbpm.task.Deadline</class>
<class>org.jbpm.task.Comment</class>
<class>org.jbpm.task.Deadline</class>
<class>org.jbpm.task.Delegation</class>
<class>org.jbpm.task.Escalation</class>
<class>org.jbpm.task.Group</class>
<class>org.jbpm.task.I18NText</class>
<class>org.jbpm.task.Notification</class>
<class>org.jbpm.task.EmailNotification</class>
<class>org.jbpm.task.EmailNotificationHeader</class>
<class>org.jbpm.task.PeopleAssignments</class>
<class>org.jbpm.task.Reassignment</class>
<class>org.jbpm.task.Status</class>
<class>org.jbpm.task.Task</class>
<class>org.jbpm.task.TaskData</class>
<class>org.jbpm.task.SubTasksStrategy</class>
<class>org.jbpm.task.OnParentAbortAllSubTasksEndStrategy</class>
<class>org.jbpm.task.OnAllSubTasksEndParentEndStrategy</class>
<class>org.jbpm.task.User</class>
<class>org.drools.persistence.info.SessionInfo</class>
<class>org.jbpm.persistence.processinstance.ProcessInstanceInfo</class>
<class>org.jbpm.persistence.processinstance.ProcessInstanceEventInfo</class>
<class>org.drools.persistence.info.WorkItemInfo</class>
<properties>
<!-- sample MySQL configuration -->
<property name="hibernate.dialect" value="org.hibernate.dialect.MySQL5InnoDBDialect"/>
<property name="hibernate.connection.driver_class" value="com.mysql.jdbc.Driver"/>
<property name="hibernate.connection.url" value="jdbc:mysql://localhost:3306/jbpm5db" />
<property name="hibernate.connection.username" value="test1"/>
<property name="hibernate.connection.password" value="test1"/>
<property name="hibernate.connection.autocommit" value="false" />
<property name="hibernate.max_fetch_depth" value="3"/>
<property name="hibernate.hbm2ddl.auto" value="create" />
<property name="hibernate.show_sql" value="true" />
</properties>
</persistence-unit>
<!-- <persistence-unit name="hibernatetest" transaction-type="RESOURCE_LOCAL"> -->
<!-- <provider>org.hibernate.ejb.HibernatePersistence</provider> -->
<!-- <properties> -->
<!-- H2 dialect -->
<!-- <property name="hibernate.dialect" value="org.hibernate.dialect.MySQLDialect"/> -->
<!-- <property name="hibernate.connection.url" value="jdbc:mysql://localhost:3306/HibernateTest"/> -->
<!-- <property name="hibernate.connection.driver_class" value="com.mysql.jdbc.Driver"/> -->
<!-- <property name="hibernate.connection.password" value="test1"/> -->
<!-- <property name="hibernate.connection.username" value="test1"/> -->
<!-- <property name="hibernate.connection.autocommit" value="false"/> -->
<!-- <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>
Any suggestions on how I prevent JBPM from creating my db tables into JBPM's table ?