parent key not found error via a two level One-To-Many relationship
696567Apr 20 2009 — edited Dec 13 2011Dear All,
I try to abstract my problem as clear as possible.
I have the following mapping involving three entities A, B, and C.
The relationship is that A contain a collection of B, which in turn contains a collection of C.
when I tried the code.
A a = retrievedFromDatabase();
B b= new B();
.
.
C c = new C();
b.add(c)
a.add(b)
merge(a)
then the "parent key not found" on table of c.
I don't have such a problem when I simply
A a = retrievedFromDatabase();
B b= new B();
a.add(b);
merge(a);
could someone tell me the reason ?
thanks in advance
Zhiqiang
Edited by: user5306236 on Apr 20, 2009 4:04 PM
Edited by: user5306236 on Apr 20, 2009 4:17 PM
Edited by: user5306236 on Apr 20, 2009 4:46 PM