项目结构:
hibernate.cfg.xml
为什么会报:
org.hibernate.InvalidMappingException: Could not parse mapping document from resource com/baidu/hibernate/oneTOone/primary/Department.hbm.xml
Caused by: org.hibernate.DuplicateMappingException: duplicate import: Department refers to both com.baidu.hibernate.oneTOone.primary.Department and com.baidu.hibernate.oneTOone.foreign.Department (try using auto-import="false")
我的两个相同的实体类,分别在不同的包下, 为什么不能在 hibernate.cfg.xml 中 不能同时如上图中配置,一定要注掉一个才可以?