使用hibernate架构执行插入操作时You have an error in your SQL syntax;
2016-08-12 16:33
555 查看
今天同事在写接口时,出现SQL错误
com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'key, linkman, linkphone,
num, orderDetail, ordernum, orderstatus, ordertime, ord' at line 1
null id in com.ctcp.entity.LCD_Order entry (don't flush the Session after an exception occurs)
看了一眼,发现可能是SQL关键字的问题,因此修改了实体类的注入@Column(name = [key])等,在有关键字的地方都用[ ]括起来就OK了。假如是用hbm.xml文件来配置实体类与表的关系的话,如
<many-to-one name="infoUser" class="com.master.hibernate.model.InfoUser" fetch="select">
<column name="[USER]" />
</many-to-one>
在column name="USER"里加上[] 方括号就好啦.
同时提供sql关键字网页,要找是否为关键字可ctrl+f查询
http://www.php100.com/manual/pgsql/sql-keywords-appendix.html
com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'key, linkman, linkphone,
num, orderDetail, ordernum, orderstatus, ordertime, ord' at line 1
null id in com.ctcp.entity.LCD_Order entry (don't flush the Session after an exception occurs)
看了一眼,发现可能是SQL关键字的问题,因此修改了实体类的注入@Column(name = [key])等,在有关键字的地方都用[ ]括起来就OK了。假如是用hbm.xml文件来配置实体类与表的关系的话,如
<many-to-one name="infoUser" class="com.master.hibernate.model.InfoUser" fetch="select">
<column name="[USER]" />
</many-to-one>
在column name="USER"里加上[] 方括号就好啦.
同时提供sql关键字网页,要找是否为关键字可ctrl+f查询
http://www.php100.com/manual/pgsql/sql-keywords-appendix.html
相关文章推荐
- Hibernate操作MySQL使用reserved word引发错误: “You have an error in your SQL syntax; check the manual that co
- Hibernate操作MySQL使用reserved word引发错误: “You have an error in your SQL syntax; check the manual that co
- mysql sqlserver hibernate 有数据库关键字 You have an error in your SQL syntax; check the manual that corres
- org.hibernate.exception.SQLGrammarException: could not inYou have an error in your SQL syntax;完美解决错误
- org.hibernate.exception.SQLGrammarException: could not inYou have an error in your SQL syntax;完美解决错误
- 插入mysql语句报错:1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near
- Hibernate: You have an error in your SQL syntax; check the manual that corresponds to your MySQL
- MySql 使用mysqldump导出 You have an error in your SQL syntax
- 在使用Navicat for MySQL 出现 异常"You have an error in your SQL syntax......"
- Hibernate 与 MySql 数据库关键字冲突You have an error in your SQL syntax; check the manual
- ssh开发中插入数据时遇到 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right
- MySql 执行语句错误 Err] 1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near
- 使用PreparedStatement,出现You have an error in your SQL syntax; check the manual that corresponds to you
- ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your
- ERROR 1064 (42000): You have an error in your SQL syntax
- com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax.....
- com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax解决办法
- ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your
- You have an error in your SQL syntax
- phpmyadmin建表出错 #1064 - You have an error in your SQL syntax;