Can someone look whats the exact issue here. Let me know if you need further information on this.
1.
EmpInformation file contains the <composite-id> tag having many-to-one with Department Class Code:
<hibernate-mapping>
<class name="EmpInformation" table="emp_info" >
<composite-id name="id" class="info">
<key-property name="XXXid" type="int">
<column name="xxxid" />
</key-property>
<key-property name="AAA" type="string">
<column name="aaa" length="50" />
</key-property>
<key-property name="BBB" type="string">
<column name="bbb" length="50" />
</key-property>
</composite-id>
<many-to-one name="Dept" class="Department" update="false" insert="false" fetch="select">
<column name="AAA" length="50" not-null="true" />
<column name="BBB" length="50" not-null="true" />
</many-to-one>
</class>
</hibernate-mapping>
2.
Department class having some more mapping many-to-one and some properties.
Code:
<hibernate-mapping>
<class name="Department" table="dept_table">
<composite-id name="id" class="deptId">
<key-property name="AAA" type="string">
<column name="aaa" length="50" />
</key-property>
<key-property name="BBB" type="string">
<column name="bbb" length="50" />
</key-property>
</composite-id>
<many-to-one name="Store" class="DepartmentStore" update="false" insert="false" fetch="select">
<column name="AAA" length="50" not-null="true" />
<column name="BBB" length="50" not-null="true" />
</many-to-one>
<property name="ReportId" type="java.lang.Integer">
<column name="report_id" />
</property>
</class>
</hibernate-mapping>
Code:
1. List a = createCriteria(EmpInformation.class);
2. Integer I = a.getDepartment().getReportID();
My Questions is whenever I am trying to call the ReportID on getDepartment it's giving error as org.hibernate.ObjectNotFoundException: No row with the given identifier exists:
It seems I am not getting the Department info.
This is the stmt we are using to access the Dept information : Code:
<many-to-one name="Dept" class="Department" update="false" insert="false" fetch="select">"
I want to point some more info here
1. Lazy is true by default so whenever I access the child table entity it should get that info but it won't.
2. It's mandatory update="false" insert="false" if I remove then it's asking me to put that.