Strange behaviour running with MySQL in JBoss server
ghinwa Mar 29, 2007 3:39 PMI have been trying to use jBPM inside the App server, using MySQL. inside my jar file, in hibernate.cfg.xml I have the following:
<property name="hibernate.dialect">org.hibernate.dialect.MySQLDialect</property> <property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property> <property name="hibernate.connection.url">jdbc:mysql://localhost:3306/jbpmdb</property> <property name="hibernate.connection.username">sa</property> <property name="hibernate.connection.password">sa</property>
and in the session bean method I create the JbpmContext, perform some process definition deployment, and then close the context. Everything seems to work well and the process definition gets stored in the db.
However, when I try to specify the db connection as a data source, i.e. change the config in hibernate.cfg.xml to the following instead:
<property name="hibernate.dialect">org.hibernate.dialect.MySQLDialect</property> <property name="hibernate.connection.datasource">java:/JbpmDS</property>
and create a datasource definition in the deploy dir containing:
<local-tx-datasource> <jndi-name>JbpmDS</jndi-name> <connection-url>jdbc:mysql://localhost:3306/jbpmdb</connection-url> <driver-class>com.mysql.jdbc.Driver</driver-class> <user-name>sa</user-name> <password>sa</password> <exception-sorter-class-name> org.jboss.resource.adapter.jdbc.vendor.MySQLExceptionSorter </exception-sorter-class-name> <metadata> <type-mapping>MySQL</type-mapping> </metadata> </local-tx-datasource>
and I run the same code, I notice that the process data in the jbpm_processdefinition table contains NULL in the STARTSTATE_ field (but the remaining fields for process name, version, etc. are populated properly).... Any subsequent attempt to instantiate a process based on this definition fails (due to the null in the foreign key I suppose)
I have tried adding to hibernate.cfg.xml the following:
<property name="hibernate.transaction.factory_class">org.hibernate.transaction.JTATransactionFactory</property> <property name="hibernate.transaction.manager_lookup_class">org.hibernate.transaction.JBossTransactionManagerLookup</property> <property name="jta.UserTransaction">/UserTransaction</property>
with the side effect of not having to close() jbpm context... however the erroneous behaviour above persisted...
Any insight into this would be appreciated. I am new to jBPM, have read the tutorial and searched TFF :) however may have missed something obvious....
Thanks.