org.springframework.dao.InvalidDataAccessResourceUsageException: could not execute query; nested exception is org.hibernate.exce

本文针对出现的InvalidDataAccessResourceUsageException异常,提供了详细的排查步骤,包括检查.hbm.xml文件中的属性与数据库名称是否一致,以及确认hibernate配置文件中的dialect属性是否正确设置。

org.springframework.dao.InvalidDataAccessResourceUsageException: could not execute query; nested exception is org.hibernate.exception.SQLGrammarException: could not execute query
Caused by: java.sql.SQLException: ORA-00933: SQL 命令未正确结束

 

 

解决办法:

 

   1. 查看配置 .hbm.xml文件中的属性和数据库中名称是否对应

 

  2. 查看hibernate配置文件,或者application.xml文件中 sessionFactory 属性,或者初始化配置文件中 hibernate.dialect是否和数据库对应

 

 

  方言 是否配置正确。

 比如 :

 

 连接 mysql 

 

               <prop key="hibernate.dialect">
                    org.hibernate.dialect.MySQLDialect
                </prop>

 

连接 oralcle

 

               <prop key="hibernate.dialect">
                    org.hibernate.dialect.Oracle9Dialect
                </prop>

 

 

17:37:55 [ - ] [localhost-startStop-1] ERROR: CTPBeanFactory: - 初始化Spring失败: 17:37:55 [ - ] [localhost-startStop-1] ERROR: CTPBeanFactory: - *********************************************** 17:37:55 [ - ] [localhost-startStop-1] ERROR: CTPBeanFactory: - Bean name:secretKeyManage 17:37:55 [ - ] [localhost-startStop-1] ERROR: CTPBeanFactory: - 错误原因:Table 'v8x2.ctp_config' doesn't exist 17:37:55 [ - ] [localhost-startStop-1] ERROR: CTPBeanFactory: - Error creating bean with name 'secretKeyManage' defined in URL [file:/home/Seeyon/A8/ApacheJetspeed/webapps/seeyon/WEB-INF/cfgHome/spring/spring-transSecurity-manage.xml]: Invocation of init method failed; nested exception is org.springframework.dao.InvalidDataAccessResourceUsageException: Could not execute JDBC batch update; SQL [insert into ctp_config (config_category, config_category_name, config_description, config_item, config_type, config_value, create_date, modify_date, ext_config_value, org_account_id, SORT, id) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)]; nested exception is org.hibernate.exception.SQLGrammarException: Could not execute JDBC batch update 17:37:55 [ - ] [localhost-startStop-1] ERROR: CTPBeanFactory: - Error creating bean with name 'secretKeyManage' defined in URL [file:/home/Seeyon/A8/ApacheJetspeed/webapps/seeyon/WEB-INF/cfgHome/spring/spring-transSecurity-manage.xml]: Invocation of init method failed; nested exception is org.springframework.dao.InvalidDataAccessResourceUsageException: Could not execute JDBC batch update; SQL [insert into ctp_config (config_category, config_category_name, config_description, config_item, config_type, config_value, create_date, modify_date, ext_config_value, org_account_id, SORT, id) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)]; nested exception is org.hibernate.exception.SQLGrammarException: Could not execute JDBC batch update [code : 1879453577] org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'secretKeyManage' defined in URL [file:/home/Seeyon/A8/ApacheJetspeed/webapps/seeyon/WEB-INF/cfgHome/spring/spring-transSecurity-manage.xml]: Invocation of init method failed; nested exception is org.springframework.dao.InvalidDataAccessResourceUsageException: Could not execute JDBC batch update; SQL [insert into ctp_config (config_category, config_category_name, config_description, config_item, config_type, config_value, create_date, modify_date, ext_config_value, org_account_id, SORT, id) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)]; nested exception is org.hibernate.exception.SQLGrammarException: Could not execute JDBC batch update
07-24
context with path [] threw exception [Request processing failed; nested exception is org.springframework.dao.InvalidDataAccessResourceUsageException: could not execute query; SQL [SELECT DISTINCT line.* FROM C_LINE line INNER JOIN ( SELECT @a :=- 1, ? optDeptType, ? optid, ? sAreaId, ? eAreaId, ? claTraType, ? lineIds, ? platform ) param LEFT JOIN C_LINE_OPERATING_COMPANY lo ON lo.LINE_ID = line.ID LEFT JOIN R_OPERATING_COMPANY oc ON oc.ID = lo.OC_ID LEFT JOIN OPERATOR_LINE opli ON opli.OPERATOR_ID = param.optid AND opli.LINE_ID = line.ID WHERE ( SELECT ( param.optDeptType = 4 || param.optDeptType = 3 && line.PLATFORM = ext.PLATFORM || ( param.optDeptType = 1 && ( FIND_IN_SET( oc.DEPT_ID, IF ( @a =- 1, @a := FIND_CHILDREN_OF_DEPT ( dept.ID ), @a ) ) && opli.OPERATOR_ID IS NULL || opli.IS_INVERSE = 0 ) ) ) FROM U_OPERATOR opt LEFT JOIN U_DEPT dept ON dept.ID = opt.DEPT_ID LEFT JOIN DEPT_EXTEND ext ON ext.ID = dept.ID WHERE opt.id = param.optid ) AND IF ( param.sAreaId = - 1, TRUE, line.START_AREA_ID = param.sAreaId ) AND IF ( param.eAreaId = - 1, TRUE, line.END_AREA_ID = param.eAreaId ) AND IF ( param.claTraType = - 1, TRUE, param.claTraType = line.type ) AND IF ( param.lineIds = '-1', TRUE, FIND_IN_SET(line.ID, param.lineIds) ) AND IF ( param.platform = - 1, TRUE, param.platform = line.PLATFORM ) ORDER BY line.SORT DESC]; nested exception is org.hibernate.exception.SQLGrammarException: could not execute query] with root cause java.sql.SQLException: Column 'LEVEL' not found.
最新发布
09-29
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值