aspose file tools*
The moose likes Object Relational Mapping and the fly likes help: Duplicate mapping exception Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "help: Duplicate mapping exception" Watch "help: Duplicate mapping exception" New topic
Author

help: Duplicate mapping exception

Juzar Roopawalla
Ranch Hand

Joined: Oct 30, 2001
Posts: 37
I have all my hbm.xml files in a jar which is inside a war. I get the following on initialization:

Caused by: org.hibernate.DuplicateMappingException: Duplicate collection role mapping com.msdw.pbefficiency.servicestracker.hibernate.pojo.TimeEntry.timeEntryDetailsList 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)
... 62 more
Initial SessionFactory creation failed.javax.naming.NamingException: Could not read
mappings from resource: com/msdw/pbefficiency/servicestracker/TimeEntry.hbm.xml

TimeEntry.hbm.xml is:

<?xml version="1.0" ?>
<!DOCTYPE hibernate-mapping (View Source for full doctype...)>
- <hibernate-mapping default-cascade="none" default-access="property" default-lazy="true" auto-import="true">
- <class name="com.msdw.pbefficiency.servicestracker.hibernate.pojo.TimeEntry" table="TimeEntry" mutable="true" polymorphism="implicit" dynamic-update="false" dynamic-insert="false" select-before-update="false" optimistic-lock="version">
- <id name="timeEntryId">
<generator class="native" />
</id>
- <!-- foreign key will be inserted by parent class - TimeSheet
-->
<property name="timeSheetId" insert="false" update="false" unique="false" optimistic-lock="true" lazy="false" generated="never" />
<property name="userMins" column="userMinutes" unique="false" optimistic-lock="true" lazy="false" generated="never" />
<property name="clientId" unique="false" optimistic-lock="true" lazy="false" generated="never" />
<property name="comments" unique="false" optimistic-lock="true" lazy="false" generated="never" />
- <list name="timeEntryDetailsList" cascade="all" lazy="false" inverse="false" mutable="true" optimistic-lock="true" embed-xml="true">
<key column="timeEntryId" not-null="true" on-delete="noaction" />
<index column="idx" />
<one-to-many class="com.msdw.pbefficiency.servicestracker.hibernate.pojo.TimeEntryDetails" not-found="exception" embed-xml="true" />
</list>
</class>
</hibernate-mapping>

Unfortunately there is no help on this anywhere on the internet. Could any one throw some light on this issue ASAP. Thanks a lot in advance!
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

From reading the exception message, I'm guessing you have mapped a collection more than once. Have you defined TimeEntry.hbm.xml more than once in your configuration file?


JavaRanch FAQ HowToAskQuestionsOnJavaRanch
Juzar Roopawalla
Ranch Hand

Joined: Oct 30, 2001
Posts: 37
hi,
yes, thanks that was the problem. but due to the nature of the error i was concentrating more on the hbm.xml rather than looking into the cfg.xml.
thanks once again.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: help: Duplicate mapping exception