org.hibernate.MappingException: Unknown entity
hibernate.cfg.xml里Ctrl+點擊<mapping resource="Student.hbm.xml"/>??梢蕴D(zhuǎn)到Student.hbm.xml,
Student.hbm.xml里點擊Ctrl+點擊<class name="imooc.Student" table="STUDENT">??梢蕴D(zhuǎn)到Student.java
hibernate.cfg.xml里Ctrl+點擊<mapping resource="Student.hbm.xml"/>??梢蕴D(zhuǎn)到Student.hbm.xml,
Student.hbm.xml里點擊Ctrl+點擊<class name="imooc.Student" table="STUDENT">??梢蕴D(zhuǎn)到Student.java
2018-11-11
舉報
2020-10-11
I am coming~
2020-02-22
一萬年過去了
2020-01-09
看看是否是這個原因:https://blog.csdn.net/Thousa_Ho/article/details/70992233
2019-01-02
要看一下你的hibernate版本
5.x以上版本的寫法是不一樣的,這個是5.x版本以上的寫法
Configuration config=new Configuration().configure();//獲得配置對象
//生成一個注冊機對象
ServiceRegistry serviceRegistry = new StandardServiceRegistryBuilder().configure().build();
//創(chuàng)建會話工廠對象
SessionFactory sessionFactory = new MetadataSources(serviceRegistry).buildMetadata().buildSessionFactory();