关于hibernate映射过程中的笔记

MySQL遇到check the manual that corresponds to your MySQL server version for the right syntax错误

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 ' at line 1的错误,找了许久无用,终于在百度上找到 了正确的方法,原谅是关键字的原因,看到version把哥下了一条!难道还有更新数据库,直接把order这张表名换个名字就可以了,,后来换成了orders,于是完美运行。

关于An association from the table refers to an unmapped class  (这是网上找的方法,怕以后错了,于是把他的方法借鉴一下,以后错了好改。)

1,检查你的hibernate.cfg.xml文件中是否添加了  <mapping resource="xxxx.hbm.xml"/>

2,检查你的hibernate.cfg.xml文件中的相关联的两个<mapping resource=""/>的顺序,可能有其中一个需要引用另一个,但是另一个却还没有编译,就是说被用作外键的表要放在前面

3,检查你的*.hbm.xml文件名是否正确 4, 检查你的*.hbm.xml里面类全名

原文地址:https://www.cnblogs.com/Mindreader/p/5137843.html