我有以下SpringData存储库查询:
@Query("SELECT new com.mypackage.MobileCaseList(c.ident, concat(c.subtype, ' - ', c.contactName), c.type, coalesce(c.updateTimestamp,c.insertTimestamp) )" +
"FROM MobileCase c WHERE c.mobileUser.ident = ?1 AND c.origin = 'SOURCE' ORDER BY c.appointmentFrom NULLS LAST")
List<MobileCaseList> findCasesForUser(String userIdent);
Run Code Online (Sandbox Code Playgroud)
并遵循运行时代码:
List<MobileCaseList> result = caseRepo.findCasesForUser(userIdent);
Run Code Online (Sandbox Code Playgroud)
到目前为止,这种方法运行良好 - 不知道是什么导致了例外.在我的电脑(localhost)上它仍然有用!?但是在Ubuntu服务器上,查询执行失败并出现以下错误:
2016-02-17 12:56:49.696 ERROR 13397 --- [http-nio-9090-exec-6] o.a.c.c.C.[.[.[/].[dispatcherServlet] : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is org.springframework.dao.InvalidDataAccessApiUsageException: org.hibernate.QueryException: ResultTransformer is not allowed for 'select new' queries.; nested exception is java.lang.IllegalArgumentException: org.hibernate.QueryException: …
Run Code Online (Sandbox Code Playgroud)