I have a case where the joined-subclass (STRUCTURED) whose base class is Relationship participates in an ordered list of with another parent (Site).
Code:
|--------| |--------------|
| Site | | Relationship |
|--------| |--------------|
| |
| Ordered |
| List |joined-subclass
|--------------------------|
| Structured |
|--------------------------|
The list statement in the Site.hbm.xml follows:
<list name="parts" lazy="true" table="STRUCTURED" cascade="all" order-by="DEPTH" sort="natural">
<key column="SITE_ID" />
<index column="ORDERING_DEPTH"
<element column="DEPTH" type="integer" not-null="true" />
</list>
If I don't specify the ORDERING_DEPTH property in the Structured joined-subclass, when the Structured class is saved the parameter index is out of range. There is one more parameter then is listed in the SQL. That parameter is the ORDERING_DEPTH setting. The SQL for the structured insert does not have the ORDERING_DEPTH field. The DDL table does have the ORDERING_DEPTH column and hibernate is attempting to set it.
If I do specify an ORDERING_DEPTH property, then during the insert hibernate fails to establish this field and I get a error for trying to save a non-nullable field in the insert.
Do I have the <list...> specified wrong? I have searched the documentation on <list> and it doesn't cover this situation - or at least I couldn't find it. Is there a known issue with using a list with a joined-subclass?