• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

help: Duplicate mapping exception

 
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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!
 
Bartender
Posts: 10336
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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?
 
Juzar Roopawalla
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic