Hi,
I have a collection of "Students" inside the "Class" object. While adding a student I add the student to the Class and try saving the class object. Now,I have added the version in the Student Object and when I add a new Student to the Class and try saving the Class object,the version of all the previously added students also changes.I want some mapping attribute,which does not update the previously added objects and adds only the newly added Student object to the collection Class .
Here is the sample mapping
<class name="x.y.z.ClassA" table="CLASS_A">
<id name="id" type="long" column="ID" unsaved-value="0">
<generator class="native"/>
</id>
<list name="students" lazy="true"
cascade="all-delete-orphan" access="field">
<key column="CLASS_A_ID"/>
<index column="SORT_INDEX"/>
<one-to-many class="x.y.z.Student"/>
</list>
</class>
<class name="x.y.z.Student" table="STUDENT">
<id name="id" column="ID" type="long">
<generator class="native"/>
</id>
<version
column="version_column"
name="version"
type="long"
/>
</version>
</class>
|