无法提取ResultSet错误

时间:2017-12-14 11:10:01

标签: spring java-8 spring-data-jpa postgresql-9.6 spring-orm

我收到could not extract ResultSet错误。我检查了存储库方法,查看返回零结果的情况,一切似乎都正常。我无法理解并重现错误。有线索吗?

以下是我的存储库方法,其中报告了错误 -

@Query(value="select * from rsp_customer_post_snapshot main where exists (select 1 from (SELECT snap.post_id, max(snap.snapshotted_at) max_snap_at FROM rsp_customer_post_snapshot snap JOIN rsp_customer_post post on snap.post_id=post.post_id WHERE post.social_user_id = 123 AND snap.created_at >= '2017-11-01' group by snap.post_id) b where main.post_id=b.post_id and main.snapshotted_at = b.max_snap_at) ORDER BY main.created_at DESC", nativeQuery=true)
Collection<RecordSnapshot> findByUserIdAndCreatedAt(@Param("user_id") Long userId, @Param("created_at") Date createdAt);

以下是我得到的错误 -

Caused by: org.springframework.orm.jpa.JpaSystemException: could not extract ResultSet; nested exception is org.hibernate.exception.GenericJDBCException: could not extract ResultSet
at org.springframework.orm.jpa.vendor.HibernateJpaDialect.convertHibernateAccessException(HibernateJpaDialect.java:333)
at org.springframework.orm.jpa.vendor.HibernateJpaDialect.translateExceptionIfPossible(HibernateJpaDialect.java:244)
at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.translateExceptionIfPossible(AbstractEntityManagerFactoryBean.java:488)
at org.springframework.dao.support.ChainedPersistenceExceptionTranslator.translateExceptionIfPossible(ChainedPersistenceExceptionTranslator.java:59)
at org.springframework.dao.support.DataAccessUtils.translateIfNecessary(DataAccessUtils.java:213)
at org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.invoke(PersistenceExceptionTranslationInterceptor.java:147)
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.data.repository.core.support.SurroundingTransactionDetectorMethodInterceptor.invoke(SurroundingTransactionDetectorMethodInterceptor.java:57)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:213)
at com.sun.proxy.$Proxy161.findBySocialUserIdAndCreatedAt(Unknown Source)
at com.myorg.rspdatacollector.services.social.SocialPostSnapshotService.findBySocialUserIdAndCreatedAt(SocialPostSnapshotService.java:38)
at com.myorg.rspdatacollector.services.social.SocialCollectorService.synchWithSocial(SocialCollectorService.java:101)
at com.myorg.rspdatacollector.services.social.SocialCollectorService.addDataForExistingSocialUsersNotSnappedToday(SocialCollectorService.java:176)
at com.myorg.rspdatacollector.services.social.SocialCollectorService.buildCustomerSocialStore(SocialCollectorService.java:141)
at com.myorg.rspdatacollector.application.ApplicationLoader.startJob(ApplicationLoader.java:32)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleElement.invoke(InitDestroyAnnotationBeanPostProcessor.java:366)
at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleMetadata.invokeInitMethods(InitDestroyAnnotationBeanPostProcessor.java:311)
at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor.postProcessBeforeInitialization(InitDestroyAnnotationBeanPostProcessor.java:134)
... 26 common frames omitted

0 个答案:

没有答案