`
wangxiangjunpxp
  • 浏览: 37263 次
  • 来自: ...
最近访客 更多访客>>
文章分类
社区版块
存档分类
最新评论

又见“org.hibernate.DuplicateMappingException: Duplicate class/

阅读更多

感觉hibernate容易报 DuplicateMappingException:,其实很多时候并没有重复映射,也没有重复的class文件和hbm文件。一些其它的错误,hibernate也报出这样的错误,非常的误导人。

真正原因是:第一次:hibernate.cfg.xml没有同步更新。没有将必要的类配置加导这个文件里。

第二次:  <composite-id name="id" class="com.hmg.pe.data.PeMailUserId">,这里将组合铸件类的包名漏掉了,也报DuplicateMappingException异常,真是害人!!!

分享到:
评论
4 楼 gotosuzhou 2012-03-12  
还有一种情况:一对一配置时,给多余那边也配置one-to-one
3 楼 xiejin2008 2008-08-20  
我也遇到了同样的异常信息,不知道怎么解决呢.
2 楼 youjianbo_han_87 2008-07-09  
你说的这两个问题我都没有,可还是报这样的错
1 楼 zhukejohn 2008-06-12  
org.hibernate.DuplicateMappingException: Duplicate collection role mapping
这又是什么问题呢,博主能不能帮忙解答?
=======================================
java.lang.ExceptionInInitializerError at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:164)Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in URL [file:/D:/dev/zzsoft/target/resources/META-INF/applicationContext-hibernate.xml]: Invocation of init method failed; nested exception is org.hibernate.DuplicateMappingException: Duplicate collection role mapping zzsoft.bean.model.system.Module.operatorRights at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1032) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:420) at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:245) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:141) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:242) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:156) at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:287) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:348) at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:92) at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:77) at zzsoft.dao.BaseDaoTestCase.<clinit>(BaseDaoTestCase.java:25) ... 5 moreCaused by: org.hibernate.DuplicateMappingException: Duplicate collection role mapping zzsoft.bean.model.system.Module.operatorRights at org.hibernate.cfg.Mappings.addCollection(Mappings.java:124) at org.hibernate.cfg.HbmBinder.createClassProperties(HbmBinder.java:2056) at org.hibernate.cfg.HbmBinder.createClassProperties(HbmBinder.java:2031) at org.hibernate.cfg.HbmBinder.bindRootPersistentClassCommonValues(HbmBinder.java:359) at org.hibernate.cfg.HbmBinder.bindRootClass(HbmBinder.java:273) at org.hibernate.cfg.HbmBinder.bindRoot(HbmBinder.java:144) at org.hibernate.cfg.Configuration.add(Configuration.java:424) at org.hibernate.cfg.Configuration.addInputStream(Configuration.java:465) at org.springframework.orm.hibernate3.LocalSessionFactoryBean.buildSessionFactory(LocalSessionFactoryBean.java:651) at org.springframework.orm.hibernate3.AbstractSessionFactoryBean.afterPropertiesSet(AbstractSessionFactoryBean.java:131) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1062) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1029) ... 15 more

相关推荐

Global site tag (gtag.js) - Google Analytics