Spring Data抛出'在结果元组中找不到别名'

时间:2016-04-07 18:31:00

标签: java spring spring-data

将我的Spring Data应用程序从Gosling-SR4迁移到Hopper-SR1版本后,扩展JpaRepository的自定义查询会抛出以下消息:

Caused by: java.lang.IllegalStateException: No aliases found in result tuple! Make sure your query defines aliases!
    at org.springframework.data.jpa.repository.query.AbstractJpaQuery$TupleConverter.convert(AbstractJpaQuery.java:246) [spring-data-jpa-1.10.1.RELEASE.jar:]
    at org.springframework.data.repository.query.ResultProcessor$ChainingConverter.convert(ResultProcessor.java:185) [spring-data-commons-1.12.1.RELEASE.jar:]
    at org.springframework.data.repository.query.ResultProcessor$ChainingConverter$1.convert(ResultProcessor.java:173) [spring-data-commons-1.12.1.RELEASE.jar:]
    at org.springframework.data.repository.query.ResultProcessor$ChainingConverter.convert(ResultProcessor.java:185) [spring-data-commons-1.12.1.RELEASE.jar:]
    at org.springframework.data.repository.query.ResultProcessor.processResult(ResultProcessor.java:142) [spring-data-commons-1.12.1.RELEASE.jar:]
    at org.springframework.data.jpa.repository.query.AbstractJpaQuery.doExecute(AbstractJpaQuery.java:107) [spring-data-jpa-1.10.1.RELEASE.jar:]
    at org.springframework.data.jpa.repository.query.AbstractJpaQuery.execute(AbstractJpaQuery.java:92) [spring-data-jpa-1.10.1.RELEASE.jar:]
    at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.doInvoke(RepositoryFactorySupport.java:482) [spring-data-commons-1.12.1.RELEASE.jar:]
    at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.invoke(RepositoryFactorySupport.java:460) [spring-data-commons-1.12.1.RELEASE.jar:]
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) [spring-aop-4.2.5.RELEASE.jar:4.2.5.RELEASE]
    at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:99) [spring-tx-4.2.5.RELEASE.jar:4.2.5.RELEASE]
    at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:281) [spring-tx-4.2.5.RELEASE.jar:4.2.5.RELEASE]
    at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96) [spring-tx-4.2.5.RELEASE.jar:4.2.5.RELEASE]
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) [spring-aop-4.2.5.RELEASE.jar:4.2.5.RELEASE]
    at org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.invoke(PersistenceExceptionTranslationInterceptor.java:136) [spring-tx-4.2.5.RELEASE.jar:4.2.5.RELEASE]
    ... 113 more

此版本是否有任何新配置?该怎么做才能修复它?

1 个答案:

答案 0 :(得分:4)

它被识别为此版本中的错误,将在Hopper-SR2版本中解决。