2016-02-17 9 views
9

मैं निम्नलिखित SpringData भंडार क्वेरी है:QueryException: ResultTransformer 'नए' चुनें लिए अनुमति नहीं है प्रश्नों

@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); 

और निम्न क्रम कोड:

List<MobileCaseList> result = caseRepo.findCasesForUser(userIdent); 

यह अब तक ठीक काम किया - पता नहीं अब अपवाद का कारण क्या है। मेरे पीसी (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: ResultTransformer is not allowed for 'select new' queries.] with root cause 

org.hibernate.QueryException: ResultTransformer is not allowed for 'select new' queries. 
    at org.hibernate.loader.hql.QueryLoader.checkQuery(QueryLoader.java:502) ~[hibernate-core-4.3.11.Final.jar!/:na] 
    at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:496) ~[hibernate-core-4.3.11.Final.jar!/:na] 
    at org.hibernate.hql.internal.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:387) ~[hibernate-core-4.3.11.Final.jar!/:na] 
    at org.hibernate.engine.query.spi.HQLQueryPlan.performList(HQLQueryPlan.java:236) ~[hibernate-core-4.3.11.Final.jar!/:na] 
    at org.hibernate.internal.SessionImpl.list(SessionImpl.java:1300) ~[hibernate-core-4.3.11.Final.jar!/:na] 
    at org.hibernate.internal.QueryImpl.list(QueryImpl.java:103) ~[hibernate-core-4.3.11.Final.jar!/:na] 
    at org.hibernate.jpa.internal.QueryImpl.list(QueryImpl.java:573) ~[hibernate-entitymanager-4.3.11.Final.jar!/:na] 
    at org.hibernate.jpa.internal.QueryImpl.getResultList(QueryImpl.java:449) ~[hibernate-entitymanager-4.3.11.Final.jar!/:na] 
    at org.springframework.data.jpa.repository.query.JpaQueryExecution$CollectionExecution.doExecute(JpaQueryExecution.java:114) ~[spring-data-jpa-1.10.0.M1.jar!/:na] 
    at org.springframework.data.jpa.repository.query.JpaQueryExecution.execute(JpaQueryExecution.java:78) ~[spring-data-jpa-1.10.0.M1.jar!/:na] 
    at org.springframework.data.jpa.repository.query.AbstractJpaQuery.doExecute(AbstractJpaQuery.java:102) ~[spring-data-jpa-1.10.0.M1.jar!/:na] 
    at org.springframework.data.jpa.repository.query.AbstractJpaQuery.execute(AbstractJpaQuery.java:92) ~[spring-data-jpa-1.10.0.M1.jar!/:na] 
    at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.doInvoke(RepositoryFactorySupport.java:482) ~[spring-data-commons-1.12.0.M1.jar!/:na] 
    at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.invoke(RepositoryFactorySupport.java:460) ~[spring-data-commons-1.12.0.M1.jar!/:na] 
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) ~[spring-aop-4.2.4.RELEASE.jar!/:na] 
    at org.springframework.data.projection.DefaultMethodInvokingMethodInterceptor.invoke(DefaultMethodInvokingMethodInterceptor.java:61) ~[spring-data-commons-1.12.0.M1.jar!/:na] 
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) ~[spring-aop-4.2.4.RELEASE.jar!/:na] 
    at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:99) ~[spring-tx-4.2.4.RELEASE.jar!/:na] 
    at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:281) ~[spring-tx-4.2.4.RELEASE.jar!/:na] 
    at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96) ~[spring-tx-4.2.4.RELEASE.jar!/:na] 
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) ~[spring-aop-4.2.4.RELEASE.jar!/:na] 
    at org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.invoke(PersistenceExceptionTranslationInterceptor.java:136) ~[spring-tx-4.2.4.RELEASE.jar!/:na] 
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) ~[spring-aop-4.2.4.RELEASE.jar!/:na] 
    at org.springframework.data.jpa.repository.support.CrudMethodMetadataPostProcessor$CrudMethodMetadataPopulatingMethodInterceptor.invoke(CrudMethodMetadataPostProcessor.java:131) ~[spring-data-jpa-1.10.0.M1.jar!/:na] 
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) ~[spring-aop-4.2.4.RELEASE.jar!/:na] 
    at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:92) ~[spring-aop-4.2.4.RELEASE.jar!/:na] 
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) ~[spring-aop-4.2.4.RELEASE.jar!/:na] 
    at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:208) ~[spring-aop-4.2.4.RELEASE.jar!/:na 
    at com.sun.proxy.$Proxy144.findCasesForUser(Unknown Source) ~[na:na] 

कोई भी विचार, सुझाव ...?

+1

मुझे वसंत-डेटा-जेपीए को नवीनतम संस्करण में अपडेट करने के बाद एक ही समस्या है ... –

+3

इस बारे में कोई समस्या है। https://jira.spring.io/browse/DATAJPA-938 – leonardoborges

+0

क्या आपने इस मुद्दे पर एक नज़र डाली है? शायद आप वसंत डेटा के विभिन्न संस्करणों का इस्तेमाल किया? –

उत्तर

0

जैसा कि @ एलोनर्डोबॉर्गेस ने लिखा था, यह समस्या was described as bug है, और संस्करण 1.10.3 के बाद तय किया जाना चाहिए। समस्या के बारे में यहां जोड़ने के लिए और कुछ भी नहीं है।

संबंधित मुद्दे