There are one to many association between the following class:
Code:
---------------------------------------------------------------------------
<class
name="EventLog"
table="chassis_event_log"
dynamic-update="false"
dynamic-insert="false"
>
<id
name="id"
column="id"
type="java.lang.String"
length="32"
unsaved-value="null"
>
<generator class="uuid.hex">
</generator>
</id>
<property
name="trapTime"
type="java.util.Date"
update="true"
insert="true"
column="trap_time"
/>
<many-to-one
name="chassis"
class="Chassis"
cascade="none"
outer-join="auto"
update="true"
insert="true"
column="serial_number"
not-null="false"
/>
</class>
--------------------------------------------------------------------------
<class
name="com.threeup.phoenix.persistence.Chassis"
table="chassis"
dynamic-update="true"
dynamic-insert="false"
>
<id
name="serialNumber"
column="serial_number"
type="java.lang.String"
length="32"
>
<generator class="assigned">
</generator>
</id>
<set
name="eventLogs"
lazy="true"
inverse="true"
cascade="none"
sort="unsorted"
order-by="trap_time desc"
>
<key
column="serial_number"
/>
<one-to-many
class="EventLog"
/>
</set>
</class>
-----------------------------------------------------------
Now there are some records in EventLog associated with one record in Chassis. when I delete this record in Chassis, I still retain those records in EventLog.
but when I select these records from EventLog then, the following error occurs:
net.sf.hibernate.ObjectNotFoundException: No row with the given identifier exists (serialnumber of chassis)......
from what i see, it seems that when hibernate select records from EventLog, it also fetch relevant record from Chassis.
can this fetch be disabled?
Thanks a lot!