What I'm trying figure out is why an orphan record is getting left behind when I set the Address on the Person to null then I save the Person. Shouldn't hibernate automatically delete the address from the table?
Thanks,
b2s
Class Definitions
Code:
public class Person {
private Address address;
}
public class Address {
}
Mapping DefinitionsCode:
<hibernate-mapping>
<class name="Person" table="Person" lazy="true" >
<many-to-one foreign-key="FK__Person__Address"
name="person"
cascade="all-delete-orphan"
class="Address"
column="AddressId"
not-null="false"
access="field"
lazy="true"
/>
</class>
<class name="Address" table="Address" lazy="true" >
</class>
</hibernate-mapping>