admin管理员组

文章数量:1550527

在利用hibernate的session.save()方法生成table,并插入数据时,报了如下错误


ERROR: 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 'ORDER (ORDER_NAME, CUSTOMER_ID) values ('aaa', 2)' at line 1

八月 07, 2017 12:05:23 下午 org.hibernate.AssertionFailure <init>

ERROR: HHH000099: an assertion failure occured (this may indicate a bug in Hibernate, but is more likely due to unsafe use of the session): org.hibernate.AssertionFailure: null id in n21.Order entry (don't flush the Session after an exception occurs)


检查后发现问题在标红字体那一段,然后把Order.hbm.xml中的 <class name="n21.Order" table="ORDER"> table="ORDER"改成ORDERS,看来,order是mysql的关键字啊

本文标签: 时报语法错误方法Hibernatesave