I left topic on this hanging a couple of weeks ago, but now I'm back to it. Still having a problem with replication. I've got a JIRA submission ready to go on this.
When I try to replicate a joined-subclass with a list, I get an SQL error if the list index property is set to not-null="true"
Mapping:
Code:
<hibernate-mapping default-cascade="save-update">
<class name="com.foo.bar.DataObject" schema="base" table="data_objects">
<id name="id" type="long">
<generator class="native"/>
</id>
<version name="version" type="timestamp" unsaved-value="null"/>
<joined-subclass name="com.foo.bar.DataSubclass" schema="base" table="data_subclasses">
<key><column name="id"/></key>
<property name="name" type="string" not-null="true" unique="true">
<meta attribute="use-in-tostring">true</meta>
</property>
<list name="items" lazy="false" inverse="false">
<key column="parent"/>
<index column="collection_order"/>
<one-to-many class="com.foo.bar.CollectionData"/>
</list>
</joined-subclass> <!-- DataSubclass -->
<joined-subclass name="com.foo.bar.CollectionData" schema="base" table="collection_data">
<key><column name="id"/></key>
<!-- Only works when not-null="false" -->
<property name="collectionOrder" type="integer" column="collection_order" not-null="true" unique="false"/>
<many-to-one name="parent" class="com.foo.bar.DataSubclass"/>
<property name="data" type="string" not-null="false" unique="false"/>
</joined-subclass> <!-- ListData -->
</class> <!-- DataObject -->
</hibernate-mapping>
When I perform a straight replication of all DataObjects from one DB to another, any DataSubclass with a list of CollectionData objects causes an error. The SQL "update base.collection_data set parent=null, collection_order=null where parent=?" is sent to the DB, and collection_order has a not-null constraint.