-
Feature Request
-
Resolution: Done
-
Blocker
-
None
-
None
-
Medium
i am using drools-bam to persist the history to MySQL DB with the below configuration
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
<session-factory>
<!-- Database connection settings -->
<property name="connection.driver_class">com.mysql.jdbc.Driver</property>
<property name="connection.url">jdbc:mysql://localhost:3306/drools</property>
<property name="connection.username">root</property>
<property name="connection.password">JAVA</property>
<!-- JDBC connection pool (use the built-in) -->
<property name="connection.pool_size">1</property>
<!-- SQL dialect -->
<property name="dialect">org.hibernate.dialect.MySQLInnoDBDialect</property>
<!-- Enable Hibernate's automatic session context management -->
<property name="current_session_context_class">thread</property>
<!-- Disable the second-level cache -->
<property name="cache.provider_class">org.hibernate.cache.NoCacheProvider</property>
<!-- Echo all executed SQL to stdout -->
<property name="show_sql">true</property>
<!-- Drop and re-create the database schema on startup -->
<property name="hbm2ddl.auto">create</property>
and with the following hibernate mapping file:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
<class name="org.drools.process.audit.ProcessInstanceLog" >
<id name="id" >
<generator class="native"/>
</id>
<property name="processInstanceId"/>
<property name="processId"/>
<property name="start" type="timestamp" column="START_DATE"/>
<property name="end" type="timestamp" column="END_DATE"/>
</class>
<class name="org.drools.process.audit.NodeInstanceLog" >
<id name="id">
<generator class="native"/>
</id>
<property name="type"/>
<property name="nodeInstanceId"/>
<property name="nodeId"/>
<property name="processInstanceId"/>
<property name="processId"/>
<property name="date" type="timestamp" column="DATE"/>
</class>
</hibernate-mapping>
<mapping resource="DroolsAuditLog.hbm.xml" />
</session-factory>
</hibernate-configuration>
when i run mu unit test i get the following logging
INFO: Running hbm2ddl schema export
Apr 16, 2010 3:45:36 PM org.hibernate.tool.hbm2ddl.SchemaExport execute
INFO: exporting generated schema to database
Apr 16, 2010 3:45:37 PM org.hibernate.tool.hbm2ddl.SchemaExport create
SEVERE: Unsuccessful: create table NodeInstanceLog (id varchar(255) not null auto_increment, type integer, nodeInstanceId varchar(255), nodeId varchar(255), processInstanceId bigint, processId varchar(255), DATE datetime, primary key (id))
Apr 16, 2010 3:45:37 PM org.hibernate.tool.hbm2ddl.SchemaExport create
SEVERE: Incorrect column specifier for column 'id'
Apr 16, 2010 3:45:37 PM org.hibernate.tool.hbm2ddl.SchemaExport create
SEVERE: Unsuccessful: create table ProcessInstanceLog (id varchar(255) not null auto_increment, processInstanceId bigint, processId varchar(255), START_DATE datetime, END_DATE datetime, primary key (id))
Apr 16, 2010 3:45:37 PM org.hibernate.tool.hbm2ddl.SchemaExport create
SEVERE: Incorrect column specifier for column 'id'
Apr 16, 2010 3:45:37 PM org.hibernate.tool.hbm2ddl.SchemaExport execute
INFO: schema export complete
the id is set to varchar with auto increment...this doesn't work for MySQL
and after changing the "id" column type in hibernate-mapping to
<id name="id" type="integer">
<generator class="native"/>
</id>
i get the following error
SEVERE: expected type: java.lang.String, actual value: java.lang.Integer
i checked org.drools.process.audit.ProcessInstanceLog and org.drools.process.audit.NodeInstanceLog i realized that the id feils type is set to String which is causing a problem