Hibernate version:
3
Situation:
I have 3 classes that are linked 1 that holds a collection of objects of type 2 and type 2 holds 1 of type 3
When i save 1 all the others get saved as well (all good there), cascade is set to save-update as it should.
The problems start when i try to fetch an object of typ 1. Hibernate gets that object without a problem and the objects of type 2 in the set aswell. BUT not the type 3 object that's in the type 2 object. What he does is when he fetches the type 2 object is make a new empty type 3 object and for some reason saves that one, instead of getting the actual object from the database.
I'm using the latest version of MySQL
Mapping:
type 1:
<set name="type2s" cascade="save-update" where="bla='foo'">
<key column="type1Id"/>
<one-to-many class="Type2"/>
</set>
type 2:
<many-to-one name="type3" column="type3Id" cascade="save-update"/>
type 3:
no relevant mapping
|