Quote:
Because you forgot to set inverse="true" on the "many" end of your association. Read the parent/child mapping chapter, twice if neccessary.
Yes Christian,
That must is true, however in my case one Child can have many Parents.
Here is what i mean and i guess i will give you a concrete example.
There is a
Address table, which has a
Owner_Type and a
Owner_ID. Now a
Company could have
Adresses, a
Corporation could have
Addresses, a
Bank could have
Addresses.
So for
Company type
Address.Owner_Type="Company" and
Address.Owner_ID="Company_ID"
but for
Corporation type
Address.Owner_Type="Corporation " and
Address.Owner_ID="Corporation _ID"
In other words
Company has
"one to many" with
Address, but
Address is not a
"many to one" with
Company as
Address has
"many to one's" with
Corporation,
Bank etc also.
However when saving, let's say a
Company, for which Hibernate does have a
one to many with
Address.owner_ID related by
Company_ID, why should hibernate do it in three steps , the second step being save address with Owner ID as null.
By the way i did read the document and i think i am clear on what it explains, however this problem of mine, that i describe above, is different and i hope it is not unique.
I still think that if i have a inverse on the "one to many" side that Hibernate should do this ::::
1. Save parent entity
2. Save child entity with relating column as parent