Hi,
I have a parent object Institute which have a collection of classes inside it.
My mappings are
Code:
<subclass name="com.scientia.dms.commons.vo.EccInstitute" discriminator-value="EC">
<set name="empSet" cascade="all-delete-orphan" >
<key column="INSTITUTE_ID" />
<one-to-many class="com.scientia.dms.commons.vo.EccInstiEmployee" />
</set>
<set name="classSet" cascade="all" order-by="CLASS_ID" >
<key column="INSTITUTE_ID" />
<one-to-many class="com.scientia.dms.commons.vo.InstituteClass" />
</set>
</subclass>
We can consider InstituteClas which is defined as a Set inside the EccInstitute class. While I am saving the object of EccInstitute i can see the following queries
Code:
Hibernate: update dms_institute set HEAD=?, INSTITUTE_NAME=?, INSTI_TYPE=?, ADDRESS=?, PHONE_NO=?, EMAIL_ID=?, LOCATION=?, fax=?, PARISH_ID=? where INSTITUTE_ID=?
Hibernate: update dms_insti_class set INSTITUTE_ID=?, TUTOR=?, CLASS_NAME=?, MALE=?, FEMALE=?, CHRISTIAN=?, HINDU=?, MUSLIM=?, SC_ST=?, STRENGTH=? where CLASS_ID=?
Hibernate: update dms_insti_class set INSTITUTE_ID=?, TUTOR=?, CLASS_NAME=?, MALE=?, FEMALE=?, CHRISTIAN=?, HINDU=?, MUSLIM=?, SC_ST=?, STRENGTH=? where CLASS_ID=?
Hibernate: update dms_insti_class set INSTITUTE_ID=?, TUTOR=?, CLASS_NAME=?, MALE=?, FEMALE=?, CHRISTIAN=?, HINDU=?, MUSLIM=?, SC_ST=?, STRENGTH=? where CLASS_ID=?
Hibernate: update dms_insti_class set INSTITUTE_ID=?, TUTOR=?, CLASS_NAME=?, MALE=?, FEMALE=?, CHRISTIAN=?, HINDU=?, MUSLIM=?, SC_ST=?, STRENGTH=? where CLASS_ID=?
There are 4 classes inside the institute.These 4 additional queries (update for the classes) being fired irrespective of whether the objects are modified or not.How can I prevent this queries being fired,in the case the classes are not modified.
Thanks in advance
Shaiju