-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: MappingException: Duplicate Import Problem
PostPosted: Tue Oct 12, 2004 5:15 pm 
Newbie

Joined: Mon Sep 13, 2004 4:00 pm
Posts: 15
Location: WI
I am getting a mapping exception, duplicate import problem with a subclass. I have only included the part of the mapping xml file that I believe is relevant. If there is something else that I should be looking at, please let me know.

What causes this exception?

Hibernate version:
2.1
Mapping documents:
Code:
    <class name="com.lmig.pm.affinity.action.helper.ClientMap" table="DEXA300T">
        <id column="CLIENT_MAP_ID" name="id" type="integer">
            <generator class="sequence"/>
        </id>
        <property column="CLASS_NAME" name="ojbConcreteClass" type="string"/>
        <subclass name="com.lmig.pm.affinity.action.helper.ClientMergerClientMap"/>
        <subclass name="com.lmig.pm.affinity.action.helper.OrgMergerClientMap"/>
        <subclass name="com.lmig.pm.affinity.action.helper.OrgTransferClientMap"
/>
        <subclass name="com.lmig.pm.affinity.action.helper.PlanTransferClientMap"/>
        <subclass name="com.lmig.pm.affinity.action.helper.BillTransferClientMap"/>
    </class>
    <class
        name="com.lmig.pm.affinity.action.helper.ClientMergerClientMap" table="DEXA300T">
        <id column="CLIENT_MAP_ID" name="id" type="integer">
            <generator class="sequence"/>
        </id>
        <property column="CLASS_NAME" name="ojbConcreteClass" type="string"/>
        <property column="SRC_CLIENT_PRY_ID" name="sourceProxyId" type="integer"/>
        <many-to-one cascade="all"
            class="com.lmig.pm.affinity.action.helper.ClientProxy"
            column="sourceProxyId" name="sourceProxy"/>
        <property column="DEST_CLIENT_PRY_ID" name="destinationProxyId" type="integer"/>
        <many-to-one cascade="all"
            class="com.lmig.pm.affinity.action.helper.ClientProxy"
            column="destinationProxyId" name="destinationProxy"/>
        <set cascade="all" lazy="true" name="childProxyMaps">
            <key column="parentId"/>
            <one-to-many class="com.lmig.pm.affinity.action.helper.OrganizationMap"/>
        </set>
    </class>

Code between sessionFactory.openSession() and session.close():

Session not open yet.

Full stack trace of any exception that occurs:
Code:
(cfg.Configuration                   255 ) Could not compile the mapping document
net.sf.hibernate.MappingException: duplicate import: ClientMergerClientMap
   at net.sf.hibernate.cfg.Mappings.addImport(Mappings.java:85)
   at net.sf.hibernate.cfg.Binder.bindClass(Binder.java:126)
   at net.sf.hibernate.cfg.Binder.bindSubclass(Binder.java:161)
   at net.sf.hibernate.cfg.Binder.handleSubclass(Binder.java:1094)
   at net.sf.hibernate.cfg.Binder.propertiesFromXML(Binder.java:1055)
   at net.sf.hibernate.cfg.Binder.bindRootClass(Binder.java:362)
   at net.sf.hibernate.cfg.Binder.bindRoot(Binder.java:1256)
   at net.sf.hibernate.cfg.Configuration.add(Configuration.java:252)
   at net.sf.hibernate.cfg.Configuration.addInputStream(Configuration.java:288)
   at net.sf.hibernate.cfg.Configuration.addResource(Configuration.java:336)
   at net.sf.hibernate.cfg.Configuration.doConfigure(Configuration.java:1013)
   at net.sf.hibernate.cfg.Configuration.doConfigure(Configuration.java:969)
   at net.sf.hibernate.cfg.Configuration.configure(Configuration.java:897)
   at net.sf.hibernate.cfg.Configuration.configure(Configuration.java:883)
   at HibernateConn.HibernatePull.<init>(HibernatePull.java:26)
   at HibernateConn.HibernatePull.main(HibernatePull.java:34)
net.sf.hibernate.MappingException: Error reading resource: HibernateConn/mapping.hbm.xml
   at net.sf.hibernate.cfg.Configuration.addResource(Configuration.java:339)
   at net.sf.hibernate.cfg.Configuration.doConfigure(Configuration.java:1013)
   at net.sf.hibernate.cfg.Configuration.doConfigure(Configuration.java:969)
   at net.sf.hibernate.cfg.Configuration.configure(Configuration.java:897)
   at net.sf.hibernate.cfg.Configuration.configure(Configuration.java:883)
   at HibernateConn.HibernatePull.<init>(HibernatePull.java:26)
   at HibernateConn.HibernatePull.main(HibernatePull.java:34)
Caused by: net.sf.hibernate.MappingException: duplicate import: ClientMergerClientMap
   at net.sf.hibernate.cfg.Mappings.addImport(Mappings.java:85)
   at net.sf.hibernate.cfg.Binder.bindClass(Binder.java:126)
   at net.sf.hibernate.cfg.Binder.bindSubclass(Binder.java:161)
   at net.sf.hibernate.cfg.Binder.handleSubclass(Binder.java:1094)
   at net.sf.hibernate.cfg.Binder.propertiesFromXML(Binder.java:1055)
   at net.sf.hibernate.cfg.Binder.bindRootClass(Binder.java:362)
   at net.sf.hibernate.cfg.Binder.bindRoot(Binder.java:1256)
   at net.sf.hibernate.cfg.Configuration.add(Configuration.java:252)
   at net.sf.hibernate.cfg.Configuration.addInputStream(Configuration.java:288)
   at net.sf.hibernate.cfg.Configuration.addResource(Configuration.java:336)
   ... 6 more

Name and version of the database you are using:
DB2
The generated SQL (show_sql=true):
...
Debug level Hibernate log excerpt:

...


Top
 Profile  
 
 Post subject:
PostPosted: Wed Oct 13, 2004 9:34 am 
Newbie

Joined: Mon Sep 13, 2004 4:00 pm
Posts: 15
Location: WI
I misunderstood the documentation. I thought that each <subclass> also needed it's own <class> element to define the properties of the class.

After re-reading it (and a good nights rest :) ) I realized that the <property> elements go right in the <subclass> element.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.