今天在项目中,写了插入语句,用的spring data jpa,然后开始报错。下面的这个错误:
Caused by: org.hibernate.exception.SQLGrammarException: could not extract ResultSet 。
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 'condition conditione0_ where conditione0_.id='xxxxxxxxxxx'' at line 1。
在网上差了好多,好多答案是你的实体和表对不上,然后我检查了实体和表,都是一摸一样的。
我又写了一个,跟这个一摸一样的操作,插入到另一个表中,就可以插入进去,但是就这个表不行。
下面就是重点了!!!!解决办法
问题来了,检查一下你的表明是不是关键字。我们的表名是condition这个,这个是mybatis的关键字。只要是用了,就报上面的错。然后改了表名,就好了!