Hibernate&MySQL——Group是關鍵字,在使用Hibernate時不能將其作爲表名

在寫程序時,由於需要用到“分組”類,故隨手寫了Group作爲類名(坑!)。

在之後使用Hibernate自動建表時,報錯:

Caused by: org.hibernate.tool.schema.spi.SchemaManagementException: Unable to execute schema management to JDBC target [create table Group (id integer not null, name varchar(255), primary key (id))]

這就是由於使用了關鍵字Group作爲表名導致的衝突。


解決方法:將表名設置爲其它名稱即可。

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章