I tried the hibernate definition referenced in
http://forum.hibernate.org/viewtopic.php?t=942169 . I had some success but not complete success. I was able to generate a recursive definition, but for my application I needed a
list, not a
set. Items in the list were created as I expected but the index column never changed value for the entries. I would have expected there to be a different index value for each entry, starting from 0 for each (sub)list. All values are 0.
The referenced hibernate code is a set (
http://forum.hibernate.org/viewtopic.php?t=942169) and mine is a list. Is there a different definition needed for a list than a set.
----
Here is the posted definition:
Code:
<class name="Person" table="person" lazy="true">
<id name="id" column="id" type="java.lang.Long">
<generator class="hilo"/>
</id>
<set name="friends" table="person_friends" lazy="true" inverse="true">
<key column="parent_id"/>
<many-to-many class="Person" column="child_id"/>
</set>
</class>
and here is mine:
Code:
<class name="XXXStep" lazy="true">
<id name="stepID">
<generator class="native" />
</id>
<discriminator/>
<property name="stepchildID" type="integer" />
<property name="Type" not-null="true" />
<property name="NText" type="text" not-null="false"></property>
<property name="OffsetOption" not-null="false" />
<property name="ScheduleTimeOffset" type="timestamp" not-null="false" />
<property name="InclusionCondition" not-null="false" />
<property name="StepTag" not-null="false" />
<property name="Comment" type="text" not-null="false" />
<property name="listIndex" type="integer"></property>
<list name="otherXXX" cascade="all">
<key column="stepID"></key>
<index column="listIndex"></index>
<many-to-many class="XXXStep" column="stepchildID" />
</list>
</class>