我們正在升級我們的庫,並將Spring從4.2.4
升級到4.3.4
,並將Spring數據從1.9.2
升級到1.10.5
。我們還使用Hibernate 5.2.5.Final
與MySql DB進行交談。ConverterNotFoundException將Spring升級到4.3.4後
這樣做後,我們得到以下錯誤的春季轉換。
org.springframework.core.convert.ConverterNotFoundException: No converter found capable of converting from type [org.javatuples.Pair<?, ?>] to type [my.namespace.Category]
而且它的這個回購通話。
@Query("select new org.javatuples.Pair(cpc.category, count(*)) from UnlinkedProductCategorization cpc where cpc.myField = ?1 group by cpc.category") Collection<Pair<Category,Long>> countByCategoryForContainer(MyFieldType selfContainer);
在此回購沒有任何變化,如果我們恢復到一切正常。我們還有其他的情況下,我們使用select new org.javatuples.Pair(someEntityHere, count(*))
仍然有效,所以我無法弄清楚爲什麼升級會打破它。爲什麼它認爲它應該嘗試將Pair轉換爲Category,這實際上沒有意義。
這裏的調用堆棧只是我們的最後一個方法之後
org.springframework.core.convert.ConverterNotFoundException: No converter found capable of converting from type [org.javatuples.Pair<?, ?>] to type [com.siftit.domain.core.category.Category]
at org.springframework.core.convert.support.GenericConversionService.handleConverterNotFound(GenericConversionService.java:324)
at org.springframework.core.convert.support.GenericConversionService.convert(GenericConversionService.java:206)
at org.springframework.core.convert.support.GenericConversionService.convert(GenericConversionService.java:187)
at org.springframework.data.repository.query.ResultProcessor$ProjectingConverter.convert(ResultProcessor.java:256)
at org.springframework.data.repository.query.ResultProcessor$ChainingConverter$1.convert(ResultProcessor.java:201)
at org.springframework.data.repository.query.ResultProcessor$ChainingConverter.convert(ResultProcessor.java:212)
at org.springframework.data.repository.query.ResultProcessor.processResult(ResultProcessor.java:149)
at org.springframework.data.jpa.repository.query.AbstractJpaQuery.doExecute(AbstractJpaQuery.java:121)
at org.springframework.data.jpa.repository.query.AbstractJpaQuery.execute(AbstractJpaQuery.java:106)
at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.doInvoke(RepositoryFactorySupport.java:482)
at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.invoke(RepositoryFactorySupport.java:460)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
at org.springframework.data.projection.DefaultMethodInvokingMethodInterceptor.invoke(DefaultMethodInvokingMethodInterceptor.java:61)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:99)
at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:282)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
at org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.invoke(PersistenceExceptionTranslationInterceptor.java:136)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
at org.springframework.data.jpa.repository.support.CrudMethodMetadataPostProcessor$CrudMethodMetadataPopulatingMethodInterceptor.invoke(CrudMethodMetadataPostProcessor.java:133)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:92)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:213)
at com.sun.proxy.$Proxy89.countByCategoryForContainer(Unknown Source)