An association from the table user_ product refers to an unmapped class: com. hiber.pojo. User

使用Hibernate框架实现多对多实体关系时,发现出现下图错误:

 

 

 错误内容没有建立映射。

 解决方案:影射文件hibernate.cfg.xml中添加使用到的类的映射代码:

       以User类为例:

       <mapping resource="com/hiber/pojo/User.hbm.xml"/>

hibernate.cfg.xml代码:

 

 

User.hbm.xml代码:

 

希望能够帮助到大家~

 

posted @ 2020-05-11 16:35  江河与泊  阅读(184)  评论(0编辑  收藏  举报