[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: [eclipselink-users] Entity serialization on bidirectional relationships
|
It seems you somehow have two A objects (i.e. A != A->B->A).
Where did you get A from? It seems you have violated object identity
somewhere on your server. Ensure you are always using the correct
copy/managed instance of your objects.
If you have used a NoIdentityMap (CacheType.None) this could be the cause,
if so do not do this. To disable caching set shared=false instead.
In general when querying A from the EntityManager, A == A->B->A should
always be true.
If B has a relationship to a different A, or C, then you would need to
instantiate this as well if it is lazy.
Mike Traum-2 wrote:
>
> I am seeing some odd behavior with deserialization of bidirectional
> relationships. I have the following object map:
> A->B->C
> where '->' is a one to many mapping which is bidirectional. I have no
> weaving, so the OneToMany is an IndirectList and the ManyToOne is not.
> VM1:
> - I fetch all A's with a query
> - I get the size() of the B collection so that is gets instantiated
> - serialize A's
> VM2:
> - deserialize A's
> - getting A->B->A->B throws a ValidationException about traversing a
> relationship using indirection
>
> To clarify (sort of), after deserialization, I can get B from A, but if
> I get A from B afterwards, B is then an IndirectList.
>
> If I set the OneToMany eager, this problem does not present itself.
>
> If this is not understandable, I can post my test case.
>
> Thanks,
> Mike
>
>
-----
http://wiki.eclipse.org/User:James.sutherland.oracle.com James Sutherland
http://www.eclipse.org/eclipselink/
EclipseLink , http://www.oracle.com/technology/products/ias/toplink/
TopLink
Wiki: http://wiki.eclipse.org/EclipseLink EclipseLink ,
http://wiki.oracle.com/page/TopLink TopLink
Forums: http://forums.oracle.com/forums/forum.jspa?forumID=48 TopLink ,
http://www.nabble.com/EclipseLink-f26430.html EclipseLink
Book: http://en.wikibooks.org/wiki/Java_Persistence Java Persistence
--
View this message in context: http://old.nabble.com/Entity-serialization-on-bidirectional-relationships-tp26515629p26579773.html
Sent from the EclipseLink - Users mailing list archive at Nabble.com.