简体   繁体   English

ested异常是org.hibernate.exception.GenericJDBCException:无法执行查询

[英]ested exception is org.hibernate.exception.GenericJDBCException: could not execute query

I am using Spring JPA Repository,Not able to execute query 我正在使用Spring JPA存储库,无法执行查询

Here is my java code : 这是我的Java代码:

public interface TbBamiVacationRepository extends JpaRepository<TbBamiVacation,String>{
    @Modifying
    @Query(value = "select user_id,reassign_to from tb_bami_vacation a where to_date1 >=to_date(:toDate, 'DD-MON-YYYY') and to_date(:toDate, 'DD-MON-YYYY') >=from_date and to_date(:toDate, 'DD-MON-YYYY') <=to_date1 and user_id='112'",nativeQuery=true)
    List<TbBamiVacation> findReassignedTo( @Param("toDate")String toDate);
                                      //toDate="26-MAR-2017"
}

My Logs: 我的日志:

Hibernate: select user_id,reassign_to from tb_bami_vacation a where to_date1 >=to_date(?, 'DD-MON-YYYY') and to_date(?, 'DD-MON-YYYY') >=from_date and to_date(?, 'DD-MON-YYYY') <=to_date1 and user_id='112'


org.springframework.orm.jpa.JpaSystemException: could not execute query; nested exception is org.hibernate.exception.GenericJDBCException: could not execute query
at org.springframework.orm.jpa.vendor.HibernateJpaDialect.convertHibernateAccessException(HibernateJpaDialect.java:244)
at org.springframework.orm.jpa.vendor.HibernateJpaDialect.translateExceptionIfPossible(HibernateJpaDialect.java:155)
at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.translateExceptionIfPossible(AbstractEntityManagerFactoryBean.java:417)
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$CrudMethodMetadataPopulatingMethodIntercceptor.invoke(CrudMethodMetadataPostProcessor.java:111)



Caused by: java.sql.SQLException: Invalid column name
at oracle.jdbc.driver.OracleStatement.getColumnIndex(OracleStatement.java:3677)
at oracle.jdbc.driver.OracleResultSetImpl.findColumn(OracleResultSetImpl.java:2749)
at oracle.jdbc.driver.OracleResultSet.getString(OracleResultSet.java:494)
at org.apache.tomcat.dbcp.dbcp2.DelegatingResultSet.getString(DelegatingResultSet.java:266)
at org.apache.tomcat.dbcp.dbcp2.DelegatingResultSet.getString(DelegatingResultSet.java:266)

Thanks in advance !! 提前致谢 !!

Remove 'a' from here: 从此处删除“ a”:

from tb_bami_vacation a where

Change: 更改:

@Param("toDate")

to: 至:

@Param("to_date1")

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 org.hibernate.exception.GenericJDBCException:无法执行查询 - org.hibernate.exception.GenericJDBCException: could not execute query substr错误:org.hibernate.exception.GenericJDBCException:无法执行查询 - substr error: org.hibernate.exception.GenericJDBCException: could not execute query org.hibernate.exception.GenericJDBCException:无法执行查询]的根本原因 - org.hibernate.exception.GenericJDBCException: could not execute query] with root cause org.hibernate.exception.GenericJDBCException:无法执行查询 - org.hibernate.exception.GenericJDBCException: could not execute query org.hibernate.exception.GenericJDBCException:无法在hibernate中执行语句 - org.hibernate.exception.GenericJDBCException: could not execute statement in hibernate org.hibernate.exception.GenericJDBCException:无法插入: - org.hibernate.exception.GenericJDBCException: could not insert: org.hibernate.exception.GenericJDBCException:无法执行语句 - org.hibernate.exception.GenericJDBCException: could not execute statement 更新查询的 JPA @Query 注释(oracle sql 开发人员)--org.hibernate.exception.GenericJDBCException:无法执行查询 - JPA @Query annotation for update query (oracle sql developer) -- org.hibernate.exception.GenericJDBCException: could not execute query org.hibernate.exception.GenericJDBCException:执行此代码时无法执行查询异常 - org.hibernate.exception.GenericJDBCException: could not execute query Exception while executing this code javax.persistence.PersistenceException:org.hibernate.exception.GenericJDBCException:无法使用oracle执行查询 - javax.persistence.PersistenceException: org.hibernate.exception.GenericJDBCException: could not execute query with oracle
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM