Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » Problems loading attributes from attributes of abstract type
Problems loading attributes from attributes of abstract type [message #1728877] Fri, 08 April 2016 08:28 Go to next message
ben Mising name is currently offline ben Mising nameFriend
Messages: 7
Registered: July 2009
Junior Member
Hi, i have some problems to get the following example to work in eclipselink 2.6:

class A {

  private B reference1;
}

abstract class B {
}

class B1 extends B {

  private SOME_TYPE reference2;
}

class B2 extends B {
}


TypedQuery<A> q = em.createNamedQuery("select e from A e", A.class);

LoadGroup lg = new LoadGroup();
lg.addAttribute("reference1.reference2");
q.setHint(QueryHints.LOAD_GROUP, lg);

q.getSingleResult();


Executing the query above results in a ValidationException thrown by eclipselink because the attribute "reference2" is not defined for class B.
My question is: Is there any way to get this work with eclipselink without refactoring the classes and without using multi-staged loading?

[Updated on: Tue, 12 April 2016 12:10]

Report message to a moderator

Re: Problems loading attributes from attributes of abstract type [message #1729254 is a reply to message #1728877] Tue, 12 April 2016 12:19 Go to previous message
ben Mising name is currently offline ben Mising nameFriend
Messages: 7
Registered: July 2009
Junior Member
I found a solution to the problem described above with respect to loading entities. Using an EntityGraphs (since JPA 2.1) instead of a LoadGroups seems to work.
But now, creating a detached copy of an entity via a CopyGroup runs into the same problem.
Previous Topic:Incorrect schema name during schema generation
Next Topic:Validation on preUpdate checks unchanged entities
Goto Forum:
  


Current Time: Thu Apr 25 06:55:36 GMT 2024

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

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

Back to the top