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:
...