my dog learned polymorphism*
The moose likes Object Relational Mapping and the fly likes org.hibernate.DuplicateMappingException: Duplicate collection role mapping Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "org.hibernate.DuplicateMappingException: Duplicate collection role mapping" Watch "org.hibernate.DuplicateMappingException: Duplicate collection role mapping" New topic
Author

org.hibernate.DuplicateMappingException: Duplicate collection role mapping

sailaja satya
Greenhorn

Joined: Dec 05, 2008
Posts: 5
Hi,

I am getting this exception when I run my application.

org.hibernate.MappingException: Could not read mappings from resource: hbm/casa.InterestRatePlan.hbm.xml
at org.hibernate.cfg.Configuration.addResource(Configuration.java:485)
at org.hibernate.cfg.Configuration.parseMappingElement(Configuration.java:1465)
at org.hibernate.cfg.Configuration.parseSessionFactory(Configuration.java:1433)
at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1414)
at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1390)
at org.hibernate.cfg.Configuration.configure(Configuration.java:1344)
at com.iflex.fcr.infra.das.orm.hibernate.HibernateConfiguration.prepareConfiguration(HibernateConfiguration.java:209)
at com.iflex.fcr.infra.das.orm.hibernate.HibernateConfiguration.getSessionFactory(HibernateConfiguration.java:461)
at com.iflex.fcr.infra.das.orm.hibernate.HibernateDataAccessManager.getSessionFactory(HibernateDataAccessManager.java:289)
at com.iflex.fcr.infra.das.orm.hibernate.HibernateDataAccessManager.openNewSession(HibernateDataAccessManager.java:215)
at com.iflex.fcr.infra.das.orm.hibernate.HibernateDataAccessor.executeWithImplicitSession(HibernateDataAccessor.java:120)
at com.iflex.fcr.infra.das.orm.hibernate.HibernateDataAccessor.execute(HibernateDataAccessor.java:103)
at com.iflex.fcr.infra.das.orm.hibernate.HibernateDataAccessor.executeFind(HibernateDataAccessor.java:213)
at com.iflex.fcr.entity.security.User.getHostPrivilege(User.java:468)
at com.iflex.fcr.entity.security.User$$BulkBeanByCGLIB$$ad475938.getPropertyValues(<generated>)
at net.sf.cglib.beans.BulkBean.getPropertyValues(BulkBean.java:48)
at org.hibernate.util.ReflectHelper.getBulkBean(ReflectHelper.java:198)
at org.hibernate.tuple.PojoEntityTuplizer.<init>(PojoEntityTuplizer.java:84)
at org.hibernate.tuple.TuplizerLookup.create(TuplizerLookup.java:64)
at org.hibernate.tuple.EntityMetamodel.<init>(EntityMetamodel.java:257)
at org.hibernate.persister.entity.AbstractEntityPersister.<init>(AbstractEntityPersister.java:412)
at org.hibernate.persister.entity.SingleTableEntityPersister.<init>(SingleTableEntityPersister.java:108)
at org.hibernate.persister.PersisterFactory.createClassPersister(PersisterFactory.java:55)
at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:216)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1176)
at com.iflex.fcr.infra.das.orm.hibernate.HibernateConfiguration.buildSessionFactory(HibernateConfiguration.java:256)
at com.iflex.fcr.infra.das.orm.hibernate.HibernateConfiguration.getSessionFactory(HibernateConfiguration.java:463)
at com.iflex.fcr.infra.das.orm.hibernate.HibernateDataAccessManager.getSessionFactory(HibernateDataAccessManager.java:289)
at com.iflex.fcr.infra.das.orm.hibernate.HibernateDataAccessManager.openSession(HibernateDataAccessManager.java:112)
at com.iflex.fcr.app.Interaction.begin(Interaction.java:227)
at com.iflex.fcr.app.customer.CustomerManager.inquire(CustomerManager.java:1285)
at com.iflex.fcr.app.customer.barclays.test.CustomerManagerTest.testInquire(CustomerManagerTest.java:73)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at junit.framework.TestCase.runTest(TestCase.java:168)
at junit.framework.TestCase.runBare(TestCase.java:134)
at junit.framework.TestResult$1.protect(TestResult.java:110)
at junit.framework.TestResult.runProtected(TestResult.java:128)
at junit.framework.TestResult.run(TestResult.java:113)
at junit.framework.TestCase.run(TestCase.java:124)
at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:130)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
Caused by: org.hibernate.DuplicateMappingException: Duplicate collection role mapping com.iflex.fcr.entity.casa.InterestRatePlan.interestTiers
at org.hibernate.cfg.Mappings.addCollection(Mappings.java:124)
at org.hibernate.cfg.HbmBinder.createClassProperties(HbmBinder.java:2030)
at org.hibernate.cfg.HbmBinder.createClassProperties(HbmBinder.java:2005)
at org.hibernate.cfg.HbmBinder.bindRootPersistentClassCommonValues(HbmBinder.java:368)
at org.hibernate.cfg.HbmBinder.bindRootClass(HbmBinder.java:282)
at org.hibernate.cfg.HbmBinder.bindRoot(HbmBinder.java:153)
at org.hibernate.cfg.Configuration.add(Configuration.java:386)
at org.hibernate.cfg.Configuration.addInputStream(Configuration.java:427)
at org.hibernate.cfg.Configuration.addResource(Configuration.java:482)
... 47 more
Error Inside Inquire
java.lang.NullPointerException
at com.iflex.fcr.app.Interaction.analyzeAndThrowException(Interaction.java:797)
at com.iflex.fcr.app.Interaction.close(Interaction.java:492)
at com.iflex.fcr.app.Interaction.logAndThrowFatalException(Interaction.java:408)
at com.iflex.fcr.app.Interaction.begin(Interaction.java:270)
at com.iflex.fcr.app.customer.CustomerManager.inquire(CustomerManager.java:1285)
at com.iflex.fcr.app.customer.barclays.test.CustomerManagerTest.testInquire(CustomerManagerTest.java:73)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at junit.framework.TestCase.runTest(TestCase.java:168)
at junit.framework.TestCase.runBare(TestCase.java:134)
at junit.framework.TestResult$1.protect(TestResult.java:110)
at junit.framework.TestResult.runProtected(TestResult.java:128)
at junit.framework.TestResult.run(TestResult.java:113)
at junit.framework.TestCase.run(TestCase.java:124)
at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:130)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)

There are not any duplicate mappings. I have double checked it.

My hbm file is something like this...

<class name="com.iflex.fcr.entity.casa.InterestRatePlan" table="ch_int_plan" lazy="false">
<composite-id unsaved-value="none">
<key-property name="id" column="cod_plan" type="long"/>
<key-property name="effectiveDate" column="dat_effective" type="date"/>
<key-property name="interestType" column="cod_int_type" type="com.iflex.fcr.enumeration.InterestType"/>
<key-property name="status" column="flg_mnt_status" type="com.iflex.fcr.enumeration.StatusType"/>
</composite-id>
<array name="interestTiers" table="ch_int_rate_tier_plan" cascade="all" inverse="false">
<key>
<column name="cod_plan" sql-type="NUMBER"/>
<column name="dat_effective" sql-type="DATE"/>
<column name="cod_int_type" sql-type="VARCHAR2(5)"/>
<column name="flg_mnt_status" sql-type="CHAR(1)"/>
</key>
<index column="tier_index"/>
<composite-element class="com.iflex.fcr.entity.casa.InterestRateTier">
<property name="tierNumber" column="cod_tier_no" type="long"/>
<property name="indexCode" column="cod_int_indx" type="long"/>
<property name="tierBalance" column="bal_int_tier" type="double"/>
<property name="interestVariance" column="rat_int_var" type="double"/>
<property name="indexRate" formula="(SELECT INDX_RATE.rat_indx
FROM ba_int_indx_rate INDX_RATE
WHERE INDX_RATE.cod_int_indx = cod_int_indx
AND INDX_RATE.flg_mnt_status = 'A'
AND INDX_RATE.dat_eff_int_indx =
(SELECT max(B.dat_eff_int_indx)
FROM ba_int_indx_rate B
WHERE B.cod_int_indx = cod_int_indx
AND B.flg_mnt_status = 'A'
AND B.dat_eff_int_indx <=
(SELECT BANKMAST.dat_process
FROM ba_bank_mast BANKMAST
WHERE BANKMAST.flg_mnt_status = 'A')))"/>



</composite-element>
</array>

.........................................
.........................................

Can anyone please help me?

Thanks in advance
Smily
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: org.hibernate.DuplicateMappingException: Duplicate collection role mapping