I have object A which is in relation one-to-many with object B.
Object A has QList<QSharedPointer<B>> and object B has QSharedPionter<A>.
Now, if I insert object A1, B1, B2, B3, and then I add objects B1, B2, B3 to Qlist in object A1 and call update_with_all_relation(A1), the relation isn't persist.
But if I set in B1 QSharedPionter<A> = A1, and update_with_all_relation(B1), the foreign key is save.
this doesn't work
- Code: Select all
A1->m_ListB.append(B1);
A1->m_>ListB.append(B2);
qx::dao::update_with_all_relation(A1);
this work
- Code: Select all
B1->m_A.reset(A1.data());
B2->m_Areset(A1.data());
qx::dao::update_with_all_relation(B1);
qx::dao::update_with_all_relation(B2);
Somebody have any idea, what is wrong?