标签:
报错代码如下:
Caused by: org.hibernate.DuplicateMappingException: duplicate import: Engin refers to both two.entity.Engin and allview.entity.Engin (try using auto-import="false") at org.hibernate.cfg.Configuration$MappingsImpl.addImport(Configuration.java:2892) at org.hibernate.cfg.HbmBinder.bindPersistentClassCommonValues(HbmBinder.java:681) at org.hibernate.cfg.HbmBinder.bindClass(HbmBinder.java:595) at org.hibernate.cfg.HbmBinder.bindRootClass(HbmBinder.java:325) at org.hibernate.cfg.HbmBinder.bindRoot(HbmBi nder.java:178) at org.hibernate.cfg.Configuration$MetadataSourceQueue.processHbmXml(Configuration.java:3816) ... 48 more
造成这个异常的原因可能是:
在你的工程里面,有两个Engin类,比如:two.entity.Engin与allview.entity.Engin,虽然位于不同的包,但是会出现 duplicate import异常,解决办法如下:
解决Hibernate中不同包内有形同实体导致映射失败的问题
标签:
原文地址:http://www.cnblogs.com/xrab/p/5463229.html