1 Reply Latest reply on Feb 7, 2007 9:36 AM by Sofia Jonsson

    IllegalArgumentException when using Constructor expression i

    Sofia Jonsson Newbie

      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: Not an entity:class se.callista.test.dto.EmployeeReportData

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