Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » Issue with inheritance and join fetching(Bad mapping when join fetching on an abstract entity associated by 2 onetoone)
Issue with inheritance and join fetching [message #988778] Mon, 03 December 2012 06:32 Go to next message
J LM is currently offline J LMFriend
Messages: 11
Registered: December 2012
Junior Member
Before opening a bug, I want to share the issue I encounter with EL 2.3.x and 2.4.x. Maybe this has already been discussed but I didn't find previous
Assume I have a model with an Entity E1 with 2 onetoone on another Entity E2.
E2 is an abstract class (@Inheritance) extended by 2 Entites E21 and E22. They use a discriminator column. This case is a design choice and doesn't sound too messy (to me Smile).
When retrieving an E1 object (find by id, select in jpql or criteria), the two onetoone objects are retrieved and values of their fields are correct.
As it triggers 3 sql queries, I want to optimize by join fetching the 2 onetoone : tried with jpql, criteria and JoinFetch annotation.
Now one of the two retrieved E2 objects (whatever their subtypes) have incorrect fields : the two are the same !!
The sql generated contains distinct fields for each entity but values retrieved are badly affected in the objects.
Does someone know this bug ?
I can easily provide a test case.
Found another similar issue in case of a onetomany declared on E1 with the abstract E2 class (List<E2> myList). When join fetching this relation, elements in the list are badly casted (for example an E22 object in db becomes a E21 Java object. Verified when traversing the list with an instanceof).
Can easily provide a test case too.
Re: Issue with inheritance and join fetching [message #989103 is a reply to message #988778] Tue, 04 December 2012 15:41 Go to previous messageGo to next message
James Sutherland is currently offline James SutherlandFriend
Messages: 1939
Registered: July 2009
Location: Ottawa, Canada
Senior Member

Odd issue, sounds like a bug, so please log the issue and vote for it.
My guess the issue is with the subclass columns getting confused in the join fetch indexing.


James : Wiki : Book : Blog : Twitter
Re: Issue with inheritance and join fetching [message #989108 is a reply to message #989103] Tue, 04 December 2012 16:07 Go to previous message
J LM is currently offline J LMFriend
Messages: 11
Registered: December 2012
Junior Member
Hi James,

thanks for the reply.

The issue has been logged :
https://bugs.eclipse.org/bugs/show_bug.cgi?id=395738

Confirmed the bug.
Attached a patch.

[Updated on: Wed, 05 December 2012 01:39]

Report message to a moderator

Previous Topic:one to many bidirectional self reference - problem
Next Topic:ManyToOne and JoinTable
Goto Forum:
  


Current Time: Tue Apr 23 13:38:03 GMT 2024

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

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

Back to the top