Hibernate version: HIbernate 3
Hi folks. For DP reasons I am going to give a like for like example of the problem I am seeing.
Say I have classes
Name (id_san, position_san)
and
Position (id_san, code)
Name is mapped with
<many-to-one
name="position"
class="model.Position"
cascade="none"
outer-join="true"
update="true"
insert="true"
column="position_san"
/>
Position has no reverse mappings. It only contains the primary key id property and the code property. Nothing else.
Now
I have an instance of Position (1000, 'A')
which I set to the name
name.setPosition(position)
and then save the name entity, the position_san is not being populated with the id of the Position, but if I make the association by hand by setting the position_san in the database and then fetch the Name then the Position comes out as well.
How can I get the position's id to save in position_san when I save the name? (including different mapping logic if I am doing this fundamentaly wrong)
thank you :)
|