I have following relation
Parent having two Children
Child1 and
Child2.
Following is the sample mapping.
Code:
<class name="eg.Parent">
<id name="id">
<generator class="sequence"/>
</id>
<list name="childrenList1" lazy="true" cascade="all">
<key column="parent_id"/>
<index column="child_order"/>
<one-to-many class="eg.Child1"/>
</list>
<list name="childrenList2" lazy="true" cascade="all">
<key column="parent_id"/>
<index column="child_order"/>
<one-to-many class="eg.Child2"/>
</list>
</class>
<class name="eg.Child1">
<id name="id">
<generator class="sequence"/>
</id>
<property name="name"/>
<property name="childOrder" column="child_order" type="int" not-null="true" update="false"/>
<many-to-one name="parent" class="eg.Parent" column="parent_id" not-null="true"/>
</class>
<class name="eg.Child2">
<id name="id">
<generator class="sequence"/>
</id>
<property name="name"/>
<property name="childOrder" column="child_order" type="int" not-null="true" update="false"/>
<many-to-one name="parent" class="eg.Parent" column="parent_id" not-null="true"/>
</class>
How can I re-index ChildList1, when I have deleted an Object of ChildList1 in the middle of the List through child1Dao.delete(Child1 obj) method call, without doing any operation on Parent.
Is it possible, please give your suggestions.