Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp
Hibernate version:
1.0.2
Mapping documents:
Code:
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.0">
<class name="ClassA">
<id name="Id" type="Int32">
<generator class="native" />
</id>
<one-to-one name="B" cascade="all-delete-orphan"/>
</class>
<class name="ClassB">
<id name="Id" type="Int32">
<generator class="foreign">
<param name="property">A</param>
</generator>
</id>
<one-to-one name="A" constrained="true" />
</class>
</hibernate-mapping>
The problem i am having is this:
Code:
ClassA A = new ClassA();
save, works fine
Code:
A.B = new ClassB();
B.A = A;
save, works fine
Code:
A.B = null;
save.
i would expect (hope !) that the ClassB object would be removed from the database. However, the next time i load object A, it has reappeared.
i'm sure i am missing something very simple, so any help would be gratefully received.
thanks,
mike.