Quote:
It looks like the original, somewhat arbitrary selection of where to put the FK of the 1-to-1 relationship may be forcing me to change the schema. In a 1-to-1 Parent-Child relationship it does seems more natural to put the FK in the Parent's table, especially if you want to be able to express it's optionality.
We put the FK into the child table to have the ability to change the 1:1- relationship into a 1:n-relationship in the future without changing the schema.
But I agree, if you are sure that it will remain a 1:1-relationship, it is sensible to put the FK into the parent table.
Quote:
My original question still stands though, if I assume the schema is frozen with the FK on the Parent's side, can Hibernate cascade the orphan deletion in a 1-to-1 parent child relationship?
Your mapping seems to be ok to me and I cannot see any reason why delete-orphan should not work. The only idea I have is to establish a cascaded delete on database level :-(
Or you could set 'unique' to 'false' and add the same getter/setter as mentioned in my first reply.
Regards,
Kodicic