I am having a typical problem here
I have a Class A{a1, a2} and Class B{b1,a1,b2}
relation is one to many where one A and multiple B
A has an identity column "a1" which is used in B "a1" as foreign key.
Now if I insert a record in A it gives error for the B object's foreign key "a1" saying that it is
not-null property references a null or transient value
net.sf.hibernate.PropertyValueException: not-null property references a null or transient value: B.a1
There is one way of doing this, if I put a dummy value in B.a1 then it works, and then once i get the identity column value from A.a1 I can put that value into B.a1. But this is not a good approach. Will highly appreciate if you have a good solution for this.
Thanks in advance.


Reply With Quote