IllegalArgumentException when using Constructor expression in Named Query.

I have the following JPQL-query:

SELECT NEW se.callista.test.dto.EmployeeReportData(e.firstName, e.lastName, a.city, e.employmentPeriod.startDate) FROM Employee e JOIN e.address a ORDER BY e.lastName, e.firstName

where EmployeeReportData is a dto (not an entity). The query works fine when running it as a normal query. When I put it as a named query however, I get the following error message when trying to execute it: java.lang.IllegalArgumentException: Object: se.callista.test.dto.EmployeeReportData@10f9644 is not a known entity type.

I can't find anything in the JPA-spec that says a named query cannot contain a constructor expression - am I missing something?

Found the error. It works fine now :)

Message was edited by:

Sofia_Jonsson

[789 byte] By [Sofia_Jonssona] at [2007-11-26 17:38:13]
# 1
can you post your solution here?Thanks! - markus.
m_fuchsa at 2007-7-9 0:06:22 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...