Hi,
I have two classes: A has a set of Bs, B can have one or none As:
in the A mapping:
Code:
<set
name="bees"
lazy="true"
inverse="false"
cascade="none"
sort="natural"
>
<key
column="a_id"
>
</key>
<one-to-many
class="my.B"
/>
</set>
in the B mapping:
Code:
<many-to-one
name="a"
class="my.A"
column="a_id"
not-null="false"
unique="false"
cascade="none"
outer-join="auto"
/>
I want deleting an instance of A to set B's FK (and java pointer) to null. This was working well before I added the cache but since I added caching I get a
"net.sf.hibernate.ObjectNotFoundException: No row with the given identifier exists" or a JDBC error about a foreign key not satisfied.
I suspect that I have to make A implement LifeCycle and actually iterate through each of A's Bs, setting its reference to A to null. But I hope not.
Any suggestions?