[jboss-user] [JBoss jBPM] - Problems with indexes in jbpm.history.hbm.xml
bogdanj
do-not-reply at jboss.com
Thu Jul 30 11:05:54 EDT 2009
I think there is a problem with the way indexes are defined in hibernate for history tables (jbpm.history.hbm.xml).
Example:
| <class name="HistoryProcessInstanceImpl" table="JBPM4_HIST_PROCINST">
| <id name="dbid" column="DBID_">
| <generator class="assigned" />
| </id>
|
| ...
|
| <set name="details"
| cascade="all">
| <key foreign-key="FK_HDETAIL_HPROCI">
| <column name="HPROCI_" index="IDX_HDETAIL_HPROCI" />
| </key>
| <one-to-many class="HistoryDetailImpl" />
| </set>
|
| </class>
|
If you go down in the file you will find the table for HistoryDetailImpl with the many-to-one definition:
| <class name="HistoryDetailImpl" table="JBPM4_HIST_DETAIL">
| ...
|
| <many-to-one name="historyProcessInstance"
| class="HistoryProcessInstanceImpl"
| column="HPROCI_"
| foreign-key="FK_HDET_HPROCI"
| index="IDX_HDET_HPROCI" />
| <property name="historyProcessInstanceIndex" column="HPROCIIDX_" />
|
| ...
|
So there are two name for the same index (on the same column HPROCI_): IDX_HDETAIL_HPROCI (from the inverse one-to-many relation) and IDX_HDET_HPROCI (from the direct many-to-one relation).
That causes hbm2ddl tool to create a faulty sql (in the jbpm-4.0 ditribution see db/jbpm.oracle.create.sql):
| create index IDX_HDET_HACTI on JBPM4_HIST_DETAIL (HACTI_);
|
| create index IDX_HDET_HPROCI on JBPM4_HIST_DETAIL (HPROCI_);
|
| create index IDX_HDETAIL_HACTI on JBPM4_HIST_DETAIL (HACTI_);
|
| create index IDX_HDETAIL_HVAR on JBPM4_HIST_DETAIL (HVAR_);
|
| create index IDX_HDETAIL_HTASK on JBPM4_HIST_DETAIL (HTASK_);
|
| create index IDX_HDETAIL_HPROCI on JBPM4_HIST_DETAIL (HPROCI_);
|
| create index IDX_HDET_HVAR on JBPM4_HIST_DETAIL (HVAR_);
|
| create index IDX_HDET_HTASK on JBPM4_HIST_DETAIL (HTASK_);
Oracle will throw an error about duplicate index on the same column for columns HACTI_, HVAR_, HTASK_. For whatever reason MySql and HSQLDB work fine with this indexes but oracle has a problem.
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4247034#4247034
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4247034
More information about the jboss-user
mailing list