[odb-users] Usage of lazy shared pointers in a triangle relation
Quentin Deldycke
quentindeldycke at gmail.com
Wed Oct 22 11:13:11 EDT 2014
Hi,
I have a problem using this kind of architecture:
- class A have a lazy_shared_pointer to C
- class B have a lazy_shared_pointer to another C
- class C contains a int
In my mysql database, we can easily see that our class A
is linked to a class C with value '1' and my class 'B' is linked
to a class C with value '2'.
In my code, I query all class A, for each A, we query for objects B.
For each B I print values of A, B and the class C of both of them.
Strangely, I have only output of C == '2'.
I then tried to compare the pointer of both C object stored in A and B.
I found that they are the same! So for each loop on objects B, the value of
A->C is updated to values of B->C.
Do you have any int to avoid this problem?
--
Deldycke Quentin
More information about the odb-users
mailing list