Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » Inheritance and TYPE
Inheritance and TYPE [message #1029202] Fri, 29 March 2013 09:54 Go to next message
alexandre cartapanis is currently offline alexandre cartapanisFriend
Messages: 1
Registered: March 2013
Junior Member
Eclipselink 2.3.3, Java 1.6, PostgreSQL 8.4

I have a very simple inheritance scheme, with a class "SubLine" that extends a "Line". The inheritance type is TABLE_PER_CLASS.

When i request with "select e from Line e" it returns both Lines and Sublines.
When i request with "select e from Line e where TYPE(e)=Line" i have an error :
Exception [EclipseLink-6093] (Eclipse Persistence Services - 2.3.3.v20120629-r11760): org.eclipse.persistence.exceptions.QueryException
Exception Description: Invalid Type Expression on [xxx.api.domain.model.line.Line].  The class does not have a descriptor, or a descriptor that does not use inheritance or uses a ClassExctractor for inheritance


How can i get lines without sublines? Why is the "type()" operator making this error? The operator "type()" can only be used with "SINGLE_TABLE" inheritance type?
Re: Inheritance and TYPE [message #1032038 is a reply to message #1029202] Tue, 02 April 2013 13:52 Go to previous message
James Sutherland is currently offline James SutherlandFriend
Messages: 1939
Registered: July 2009
Location: Ottawa, Canada
Senior Member

The JPQL TYPE operator requires that the table have a class discriminator column, which is only true for SINGLE_TABLE or JOINED. I would recommend using one of those instead of TABLE_PER_CLASS.

Otherwise, you could change your hierarchy to have an AbstractLine with Line and Subline subclasses, then you can choose either class directly.


James : Wiki : Book : Blog : Twitter
Previous Topic:Refreshing an entity with a reference to a cache-isolated entity has side-effects
Next Topic:JPA/DCN - working for INSERT; trouble with UPDATE
Goto Forum:
  


Current Time: Fri Mar 29 15:44:41 GMT 2024

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

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

Back to the top