类似的问题可以检查bean或者XXX.hbm.xml是否写错了 检查一下名称和类型是不是和sql中配置不一样
Posted guozuxin
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了SQLGrammarException: could not extract ResultSet相关的知识,希望对你有一定的参考价值。
could not extract ResultSet; SQL [n/a]; nested exception is org.hibernate.exception.SQLGrammarException: could not extract ResultSet
org.springframework.dao.InvalidDataAccessResourceUsageException: could not extract ResultSet; SQL [n/a]; nested exception is org.hibernate.exception.SQLGrammarException: could not extract ResultSet
at org.springframework.orm.jpa.vendor.HibernateJpaDialect.convertHibernateAccessException(HibernateJpaDialect.java:261)
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.$Proxy107.findAll(Unknown Source)
at com.paoyou.util.jpa.JPAUtils.findListForPageBySearchParams(JPAUtils.java:107)
at com.paoyou.service.center.impl.ActivitiesDispatchFromWeb.ins_activityTemplate_query(ActivitiesDispatchFromWeb.java:5501)
今天Debug时遇到一个问题导致查询失败,后来找到原因:表新增了一个字段,实体类中添加了属性,但是对应的表无该字段。
类似的问题可以检查bean或者XXX.hbm.xml是否写错了 检查一下名称和类型是不是和sql中配置不一样
以上是关于SQLGrammarException: could not extract ResultSet的主要内容,如果未能解决你的问题,请参考以下文章
SQLGrammarException:无法执行查询:找不到列?
Hibernate - OneToMany 单向映射 - SQLGrammarException
SQLGrammarException: could not extract ResultSet
org.hibernate.exception.SQLGrammarException:无法提取 ResultSet
Hibernate HQL - 不存在抛出 org.hibernate.exception.SQLGrammarException 的条件:
休眠并在 CockroachDB 中使用 @GeneratedValue 会导致 SQLGrammarException