Hello,
I have a parent-child relationship between ResultSet and KPI. But don't want to cascade a deletion of a ResultSet to the child KPIs, so this property is not set in the mapping.
I get an ObjectNotFoundException when the following occurs:
*delete ResultSet "TestRs" with ID = 101
*had existing KPI which had reference to "TestRs"; i.e. the ResultSetId column in the KPI table still had ID 101, but this ResultSet no longer exists
*when attempt to retrieve list of KPIs, get ObjectNotFoundException thrown
KPI
Code:
public class KPI {
private ResultSetVO kpiResult = null;
// getters, setters...
So KPI has a reference to its parent ResultSet.
The KPI mapping is as follows:
Code:
<class name="tap.KPI" table="KPI">
<id name="id" column="ID" type="long">
<generator class="net.sf.hibernate.tap.SessionBeanSequenceGenerator"/>
</id>
<property name="label" column="Label"/>
<many-to-one name="kpiResult" class="tap.ResultSetVO" cascade="save-update" column="ResultSetId" />
</class>
The KPI table has columns ID, Label, and ResultSetId.
When the ResultSet in question is deleted (the one w/ id 101), the ResultSetId column in the KPI table still references 101, as expected. HOWEVER: is there a way to make this a non-exception, somehow indicate that ResultSetId might refer to a deleted ResultSet?
Thanks,
Alex