加入收藏 | 设为首页 | 会员中心 | 我要投稿 东莞站长网 (https://www.0769zz.com/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 教程 > 正文

Hibernate列名是保留字的解决措施

发布时间:2021-12-11 18:07:48 所属栏目:教程 来源:互联网
导读:在Hibernate框架下,如果要操作的列名是Oracle的保留字,则会报如下的错误。 Exception in thread main org.hibernate.exception.SQLGrammarException: Could not execute JDBC batch update at org.hibernate.exception.SQLStateConverter.convert(SQLState

在Hibernate框架下,如果要操作的列名是Oracle的保留字,则会报如下的错误。
 
Exception in thread "main" org.hibernate.exception.SQLGrammarException: Could not execute JDBC batch update
 at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:90)
 at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:66)
 at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:275)
 at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:266)
 at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:167)
 at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:321)
 at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:50)
 at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1028)
 at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:366)
 at org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:137)
 at com.accp.dao.impl.LoggerDaoImpl.addLogger(LoggerDaoImpl.java:21)
 at com.accp.dao.impl.LoggerDaoImpl.main(LoggerDaoImpl.java:29)
Caused by: java.sql.BatchUpdateException:<STRONG><SPAN style="FONT-SIZE: 24px"> <SPAN style="COLOR: #ff0000">ORA-00928: 缺失 SELECT 关键字</SPAN></SPAN></STRONG>
 
 at oracle.jdbc.driver.DatabaseError.throwBatchUpdateException(DatabaseError.java:629)
 at oracle.jdbc.driver.OraclePreparedStatement.executeBatch(OraclePreparedStatement.java:9409)
 at oracle.jdbc.driver.OracleStatementWrapper.executeBatch(OracleStatementWrapper.java:211)
 at org.hibernate.jdbc.BatchingBatcher.doExecuteBatch(BatchingBatcher.java:70)
 at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:268)
 ... 9 more
 
解决的办法:在Hibernate配置文件中给关键字列加上[关键字列名]
 
<column length="500" name="[comment]" not-null="true" />

(编辑:东莞站长网)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    热点阅读