Skip to main content



      Home
Home » Eclipse Projects » EclipseLink » one to many bidirectional self reference - problem(not getting children from parent in the case of one to many bidirectional self reference)
one to many bidirectional self reference - problem [message #988974] Tue, 04 December 2012 01:51 Go to next message
Eclipse UserFriend
Hi All,

I have self reference one to many bidirectional relationship.
while persisting a child i am doing the following.

1. getParentById(parentId);
2. parent.getChildern().add(child);

The children is getting persisted. I could even see the relationship column getting populated (parentID is getting populated in childs "parentID" column ).

problem is when i retrieve the parent with id and try to get the children of that parent i am not getting, even though the DB shows relation ship.

1. getParentById(parentId);
2. parent.getChildren(); // getting emptyList here.

Even checked the logs, could see the SELECT query for the parent but no query is fired when i say parent.getChildren(). "lazyLoading" is enabled.

The same scenario works fine with Junits in standalone environment.

In weblogic10.3.5 with eclipselink version 2.4.0 ... we are facing this problem.

Thank You.
Re: one to many bidirectional self reference - problem [message #989104 is a reply to message #988974] Tue, 04 December 2012 10:43 Go to previous message
Eclipse UserFriend
You need to set both sides of any relationship. Otherwise your objects are corrupt (in the cache).

Refreshing the object will reset it to the database state, but you need to fix your code to maintain both sides of the relationship.
Previous Topic:Temporal Type in Dynamic JPA
Next Topic: Issue with inheritance and join fetching
Goto Forum:
  


Current Time: Wed Jul 23 14:13:20 EDT 2025

Powered by FUDForum. Page generated in 0.03588 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top