Hibernate报错org.hibernate.exception.SQLGrammarException: could not execute statement
Hibernate 5.2 + MySQL 5.5
今天在学习Hibernate的第一个例子时出现了许多问题:
1、org.hibernate.MappingException: Unknown entity
第一个问题产生的原因是视频中老师的Hibernate版本3.x,而我自己用的为Hibernate 5.x,两个版本创建服务对象和会话工厂对象的方法的写法不一样,因此报了这个错误。
红线为正确写法。
2、org.hibernate.exception.SQLGrammarException: could not execute statement
解决完上面的问题后接着又报了第二个错误,并且尝试了很多大神建议的方法都没能成功解决,最后终于在一篇博文下的一条评论中找到了最终的解决办法。
附链接https://segmentfault.com/q/1010000004579694,感谢第二条评论!!!
终于变成绿条条了!开心!