Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » (no subject)
(no subject) [message #713824] Tue, 09 August 2011 02:31 Go to next message
darren is currently offline darren
Messages: 15
Registered: July 2009
Junior Member
I tried the Java SE case without a constructor expression but with TYPE(e) and get the same error:

public List findAllEmployeeProjectionObjects() {
return em.createQuery(
"SELECT TYPE(e), e.id,e.name "+
"FROM Employee e "+
"ORDER BY e.name")
.getResultList();
}




Persisted examples.model.Employee[ id=158 ]
Found examples.model.Employee[ id=158 ]
Found employee: examples.model.Employee[ id=158 ]
Found employee DTO: EmployeeDTO[ id=158 ] [ name=John Doe] [ entityName=null] [ entityClass=null]
Exception in thread "main" Local Exception Stack:
Exception [EclipseLink-6093] (Eclipse Persistence Services - 2.2.0.v20110202-r8913): org.eclipse.persistence.exceptions.QueryException
Exception Description: Invalid Type Expression on [examples.model.Employee]. The class does not have a descriptor, or a descriptor that does not use inheritance or uses a ClassExctractor for inheritance
at org.eclipse.persistence.exceptions.QueryException.invalidTypeExpression(QueryException.java:717)
at org.eclipse.persistence.internal.expressions.ClassTypeExpression.validateNode(ClassTypeExpression.java:101)
at org.eclipse.persistence.expressions.Expression.normalize(Expression.java:2962)
at org.eclipse.persistence.internal.expressions.DataExpression.normalize(DataExpression.java:342)
at org.eclipse.persistence.internal.expressions.SQLSelectStatement.normalize(SQLSelectStatement.java:1311)
at org.eclipse.persistence.internal.queries.ExpressionQueryMechanism.buildReportQuerySelectStatement(ExpressionQueryMechanism.java:560)
at org.eclipse.persistence.internal.queries.ExpressionQueryMechanism.buildReportQuerySelectStatement(ExpressionQueryMechanism.java:506)
at org.eclipse.persistence.internal.queries.ExpressionQueryMechanism.prepareReportQuerySelectAllRows(ExpressionQueryMechanism.java:1542)
at org.eclipse.persistence.queries.ReportQuery.prepareSelectAllRows(ReportQuery.java:1298)
at org.eclipse.persistence.queries.ReadAllQuery.prepare(ReadAllQuery.java:628)
at org.eclipse.persistence.queries.ReportQuery.prepare(ReportQuery.java:1047)
at org.eclipse.persistence.queries.DatabaseQuery.checkPrepare(DatabaseQuery.java:577)
at org.eclipse.persistence.queries.ObjectLevelReadQuery.checkPrepare(ObjectLevelReadQuery.java:824)
at org.eclipse.persistence.queries.DatabaseQuery.prepareCall(DatabaseQuery.java:1690)
at org.eclipse.persistence.internal.jpa.EJBQueryImpl.buildEJBQLDatabaseQuery(EJBQueryImpl.java:271)
at org.eclipse.persistence.internal.jpa.EJBQueryImpl.buildEJBQLDatabaseQuery(EJBQueryImpl.java:187)
at org.eclipse.persistence.internal.jpa.EJBQueryImpl.<init>(EJBQueryImpl.java:139)
at org.eclipse.persistence.internal.jpa.EJBQueryImpl.<init>(EJBQueryImpl.java:123)
at org.eclipse.persistence.internal.jpa.EntityManagerImpl.createQuery(EntityManagerImpl.java:1376)
at examples.application.EmployeeService.findAllEmployeeProjectionObjects(EmployeeService.java:81)
at examples.application.EmployeeTest.main(EmployeeTest.java:55)
Java Result: 1
Re: (no subject) [message #713827 is a reply to message #713824] Tue, 09 August 2011 02:47 Go to previous messageGo to next message
darren is currently offline darren
Messages: 19
Registered: March 2011
Location: Sydney, Australia
Junior Member
I don't know why this has spawned a new thread, it was submitted and accepted as a reply message: http://www.eclipse.org/forums/index.php/mv/msg/233012/713819/#msg_713819
Re: (no subject) [message #715751 is a reply to message #713824] Mon, 15 August 2011 08:07 Go to previous message
Gordon Yorke is currently offline Gordon Yorke
Messages: 77
Registered: July 2009
Member
The exception states that your Employee Entity does not have an assigned Discriminator Value and is not part of a mapped Inheritance Hierarchy. As the spec requires TYPE to return the type discriminator if there is no Discriminator Value provided in the mappings then none can be returned by the TYPE operator. TYPE only works with mapped Inheritance.
Previous Topic:TYPE() fails in projection query result: EclipseLink ConversionException
Next Topic:Sometimes, unknown entity type, !? [Solved]
Goto Forum:
  


Current Time: Fri Aug 29 16:26:40 EDT 2014

Powered by FUDForum. Page generated in 0.01846 seconds