hibernate在hibernate.cfg.xml中只配置一个User.hbm.xml映射文件时没问题,但配置多个就报错
<mapping resource="com/qst/giftems/user/pojos/User.hbm.xml" />
<mapping resource="com/qst/giftems/gift/pojos/Gift.hbm.xml"/>
<mapping resource="com/qst/giftems/gift/pojos/GiftStyle.hbm.xml"/>
<mapping resource="com/qst/giftems/gift/pojos/GiftType.hbm.xml"/>
<mapping resource="com/qst/giftems/order/pojos/Order.hbm.xml"/>
<mapping resource="com/qst/giftems/order/pojos/OrderItem.hbm.xml"/>
主要报错如下:
org.hibernate.MappingException: Association references unmapped class: com/qst/giftems/gift/pojos/GiftStyle
org.hibernate.InvalidMappingException: Could not parse mapping document from resource com/qst/giftems/user/pojos/User.hbm.xmll
Caused by: org.hibernate.DuplicateMappingException: Duplicate class/entity mapping com.qst.giftems.user.pojos.User