-->
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: .DuplicateMappingException: Duplicate collection role mappin
PostPosted: Mon Nov 20, 2006 9:50 am 
Beginner
Beginner

Joined: Mon Nov 20, 2006 9:06 am
Posts: 29
Hi, i cannot find information about this problem.

I try to generate schema-export with maven-hibernate3 plugin.

I get this exception every time.

I use command:
$ mvn clean compile resources:resources hibernate3:schema-export

I can shortcut the logging to the relevant parts.


..........
........
[INFO] [clean:clean]
[INFO] Deleting directory r:\Projects\Zappa\Build\home\verhees\ACompany\ACode\sandbox\someproject-orm\target
[INFO] Deleting directory r:\Projects\Zappa\Build\home\verhees\ACompany\ACode\sandbox\someproject-orm\target\classes
[INFO] Deleting directory......... cleaning
........
........
........
Compiling 45 source files to r:\Projects\Zappa\Build\home\verhees\ACompany\ACode\sandbox\someproject-orm\target\classes
[INFO] [resources:resources]
[INFO] Using default encoding to copy filtered resources.
[INFO] [hibernate3:schema-export]
[INFO] using java version jdk15
INFO [main] (Version.java:15) - Hibernate Annotations 3.2.0.CR1
INFO [main] (Environment.java:499) - Hibernate 3.2 cr2
INFO [main] (Environment.java:532) - hibernate.properties not found
INFO [main] (Environment.java:666) - Bytecode provider name : cglib
INFO [main] (Environment.java:583) - using JDK 1.4 java.sql.Timestamp handling
INFO [main] (Configuration.java:1379) - configuring from file: hibernate.cfg.xml
DEBUG [main] (DTDEntityResolver.java:22) - trying to resolve system-id [http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd]
DEBUG [main] (DTDEntityResolver.java:24) - recognized hibernate namespace; attempting to resolve on classpath under org/hibernate/
DEBUG [main] (DTDEntityResolver.java:34) - located [http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd] in classpath
DEBUG [main] (Configuration.java:1306) - connection.driver_class=com.mysql.jdbc.Driver
DEBUG [main] (Configuration.java:1306) - connection.url=jdbc:mysql://10.1.1.172:3306/ACompany
DEBUG [main] (Configuration.java:1306) - connection.username=user
DEBUG [main] (Configuration.java:1306) - connection.password=pwd
DEBUG [main] (Configuration.java:1306) - connection.pool_size=1
DEBUG [main] (Configuration.java:1306) - dialect=org.hibernate.dialect.MySQLDialect
DEBUG [main] (Configuration.java:1306) - show_sql=true
............
............

DEBUG [main] (AnnotationConfiguration.java:424) - null<-org.dom4j.tree.DefaultAttribute@1dafbaf [Attribute: name resource value "Archetyped.hbm.xml"]
INFO [main] (Configuration.java:502) - Reading mappings from resource: Archetyped.hbm.xml
DEBUG [main] (DTDEntityResolver.java:22) - trying to resolve system-id [http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd]
DEBUG [main] (DTDEntityResolver.java:24) - recognized hibernate namespace; attempting to resolve on classpath under org/hibernate/
DEBUG [main] (DTDEntityResolver.java:34) - located [http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd] in classpath
DEBUG [main] (AnnotationConfiguration.java:424) - null<-org.dom4j.tree.DefaultAttribute@18adae2 [Attribute: name resource value "AuditDetails.hbm.xml"]
INFO [main] (Configuration.java:502) - Reading mappings from resource: AuditDetails.hbm.xml
DEBUG [main] (DTDEntityResolver.java:22) - trying to resolve system-id [http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd]
DEBUG [main] (DTDEntityResolver.java:24) - recognized hibernate namespace; attempting to resolve on classpath under org/hiberna
(about 30 hbm.xml files in same directory)
............
............
............
INFO [main] (Configuration.java:1460) - Configured SessionFactory: null
DEBUG [main] (Configuration.java:1461) - properties: {hibernate.connection.password=pwd, java.runtime.name=Java(TM) 2 Runtime Environment, Standard Edition, sun.boot.library.path=d:\Program Files\Java\jdk1.5.0_06\jre\bin, java.vm.version=1.5.0_06-b05, hibernate.connection.username=user, java.vm.vendor=Sun Microsystems Inc., java.vendor.url=http://java.sun.com/, path.separator=;, java.vm.name=Java HotSpot(TM) Client VM, file.encoding.pkg=sun.io, user.country=NL, sun.os.patch.level=Service Pack 2, java.vm.specification.name=Java Virtual Machine Specification, user.dir=r:\Projects\Zappa\Build\home\verhees\ACompany\ACode\sandbox\openehr-orm, java.runtime.version=1.5.0_06-b05, java.awt.graphicsenv=sun.awt.Win32GraphicsEnvironment, java.endorsed.dirs=d:\Program Files\Java\jdk1.5.0_06\jre\lib\endorsed, os.arch=x86, java.io.tmpdir=c:\DOCUME~1\bv\LOCALS~1\Temp\, line.separator=
, java.vm.specification.vendor=Sun Microsystems Inc., user.variant=, os.name=Windows XP, classworlds.conf=d:\Program Files\Apache Software\Maven-2.0.4/bin/m2.conf, sun.jnu.encoding=Cp1252, java.library.path=d:\Program Files\Java\jdk1.5.0_06\bin;.;C..............................j.....}
[INFO] Configuration XML file loaded: r:\Projects\Zappa\Build\home\verhees\ACompany\ACode\sandbox\openehr-orm\src\main\resources\hibernate.cfg.xml
[INFO] src/main/resources/database.properties not found within the project. Trying absolute path.
[INFO] No hibernate properties file loaded: None specified.
INFO [main] (Configuration.java:292) - Reading mappings from file: r:\Projects\Zappa\Build\home\verhees\ACompany\ACode\sandbox\openehr-orm\target\classes\FeederAudit.hbm.xml
DEBUG [main] (DTDEntityResolver.java:22) - trying to resolve system-id [http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd]
DEBUG [main] (DTDEntityResolver.java:24) - recognized hibernate namespace; attempting to resolve on classpath under org/hibernate/
DEBUG [main] (DTDEntityResolver.java:34) - located [http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd] in classpath

INFO [main] (Configuration.java:292) - Reading mappings from file: r:\Projects\Zappa\Build\home\verhees\ACompany\ACode\sandbox\openehr-orm\target\classes\ObjectReference.hbm.xml
DEBUG [main] (DTDEntityResolver.java:22) - trying to resolve system-id [http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd]
DEBUG [main] (DTDEntityResolver.java:24) - recognized hibernate namespace; attempting to resolve on classpath under org/hibernate/
DEBUG [main] (DTDEntityResolver.java:34) - located [http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd] in classpath
(again 30 more hbm-files....)
............
............
............
............
DEBUG [main] (AnnotationConfiguration.java:232) - Execute first pass mapping processing
DEBUG [main] (AnnotationConfiguration.java:336) - Process hbm files
INFO [main] (HbmBinder.java:298) - Mapping class: org.someproject.rm.common.archetyped.Archetyped -> archetyped
DEBUG [main] (HbmBinder.java:1252) - Mapped property: referenceModelVersion -> reference_model_version
DEBUG [main] (HbmBinder.java:1252) - Mapped property: archetypeID -> archetype_id
INFO [main] (HbmBinder.java:298) - Mapping class: org.someproject.rm.common.generic.AuditDetails -> audit_details
DEBUG [main] (HbmBinder.java:1252) - Mapped property: systemId -> system_id
DEBUG [main] (HbmBinder.java:1252) - Mapped property: committer -> committer_id
DEBUG [main] (HbmBinder.java:1252) - Mapped property: timeCommitted -> time_committed_id
DEBUG [main] (HbmBinder.java:1252) - Mapped property: changeType -> change_type_id
DEBUG [main] (HbmBinder.java:1252) - Mapped property: description -> description_id
INFO [main] (HbmBinder.java:815) - Mapping subclass: org.someproject.rm.common.generic.Attestation -> audit_details
DEBUG [main] (HbmBinder.java:1252) - Mapped property: attestedView -> attested_view_id
DEBUG [main] (HbmBinder.java:1252) - Mapped property: isPending -> is_pending
DEBUG [main] (HbmBinder.java:1252) - Mapped property: items
......
......
......
mapping all classes, also this one.....
INFO [main] (HbmBinder.java:298) - Mapping class: org.someproject.rm.common.archetyped.FeederAudit -> feeder_audit
DEBUG [main] (HbmBinder.java:1252) - Mapped property: feederSystemAudit -> feeder_audit_details_id
DEBUG [main] (HbmBinder.java:1252) - Mapped property: feederSystemItemIDs
DEBUG [main] (HbmBinder.java:1252) - Mapped property: originatingSystemAudit -> originating_system_audit_id
DEBUG [main] (HbmBinder.java:1252) - Mapped property: originatingSystemItemIDs

......
......
......
and more classes
......
......
......
......
and in the end, this happens
......
......
......
......
INFO [main] (Mappings.java:138) - duplicate import: org.someproject.rm.common.archetyped.FeederAudit->org.someproject.rm.common.archetyped.FeederAudit
INFO [main] (Mappings.java:138) - duplicate import: org.someproject.rm.common.archetyped.FeederAudit->FeederAudit
INFO [main] (HbmBinder.java:298) - Mapping class: org.someproject.rm.common.archetyped.FeederAudit -> feeder_audit
DEBUG [main] (HbmBinder.java:1252) - Mapped property: feederSystemAudit -> feeder_audit_details_id
[INFO] ------------------------------------------------------------------------
[ERROR] FATAL ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Duplicate collection role mapping org.someproject.rm.common.archetyped.FeederAudit.feederSystemItemIDs
[INFO] ------------------------------------------------------------------------
[INFO] Trace
org.hibernate.DuplicateMappingException: Duplicate collection role mapping org.someproject.rm.common.archetyped.FeederAudit.feederSystemItemIDs
at org.hibernate.cfg.Mappings.addCollection(Ma
ppings.java:124)
at org.hibernate.cfg.HbmBinder.createClassProperties(HbmBinder.java:2027)
at org.hibernate.cfg.HbmBinder.createClassProperties(HbmBinder.java:2002)
at org.hibernate.cfg.HbmBinder.bindRootPersistentClassCommonValues(HbmBinder.java:357)
at org.hibernate.cfg.HbmBinder.bindRootClass(HbmBinder.java:271)
at org.hibernate.cfg.HbmBinder.bindRoot(HbmBinder.java:142)
at org.hibernate.cfg.Configuration.add(Configuration.java:419)
at org.hibernate.cfg.AnnotationConfiguration.processArtifactsOfType(AnnotationConfiguration.java:338)
at org.hibernate.cfg.AnnotationConfiguration.secondPassCompile(AnnotationConfiguration.java:265)
at org.hibernate.cfg.Configuration.buildMappings(Configuration.java:1034)
at org.codehaus.mojo.hibernate3.HibernateExporterMojo.getConfiguration(HibernateExporterMojo.java:110)
at org.codehaus.mojo.hibernate3.exporter.SchemaExportMojo.doSchemaExport(SchemaExportMojo.java:63)
at org.codehaus.mojo.hibernate3.exporter.SchemaExportMojo.doExecute(SchemaExportMojo.java:51)
at org.codehaus.mojo.hibernate3.HibernateExporterMojo.execute(HibernateExporterMojo.java:60)
at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:412)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:534)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeStandaloneGoal(DefaultLifecycleExecutor.java:488)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:458)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:306)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:273)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:140)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:322)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:115)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:256)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 45 seconds
[INFO] Finished at: Mon Nov 20 14:39:28 CET 2006
[INFO] Final Memory: 6M/15M
[INFO] ------------------------------------------------------------------------

There is no duplicate import, the error happens at this hbm-file, but as I remove it, the error occurs at another hbm-file.

If I remove the offending collection-properties, the error exception at classlevel dupication comes up.

For information, my hibernate.cfg.xml (partly)

<?xml version='1.0' encoding='utf-8'?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
<session-factory>
<!-- Database connection settings -->
<property name="connection.driver_class">com.mysql.jdbc.Driver</property>
<property name="connection.url">jdbc:mysql://10.1.1.172:3306/ACompany</property>
<property name="connection.username">user</property>
<property name="connection.password">pwd</property>

<!-- JDBC connection pool (use the built-in) -->
<property name="connection.pool_size">1</property>

<!-- SQL dialect -->
<property name="dialect">org.hibernate.dialect.MySQLDialect</property>

<!-- Echo all executed SQL to stdout -->
<property name="show_sql">true</property>

<!-- Mapping files -->
<mapping resource="Archetyped.hbm.xml"/>
<mapping resource="AuditDetails.hbm.xml"/>
<mapping resource="AuthoredResource.hbm.xml"/>
<mapping resource="Contribution.hbm.xml"/>
<mapping resource="DataValue.hbm.xml"/>
<mapping resource="EHR.hbm.xml"/>
<mapping resource="EventContext.hbm.xml"/>
<mapping resource="FeederAudit.hbm.xml"/>
(there are more mapping files, but this is the one that gives the error, at this moment)
</session-factory>
</hibernate-configuration>

Thanks in advance for helping, I am struggling three days with this now,


Top
 Profile  
 
 Post subject:
PostPosted: Mon Nov 20, 2006 12:55 pm 
Beginner
Beginner

Joined: Mon Nov 20, 2006 9:06 am
Posts: 29
I think it loads the hbm-files from classpath anyway, and then tries to laod the hbm-files from hibernate.cfg.zml, and in this way loads the hbm files twice.

I removed the hbm-files from the hibernate.cfg.xml, and now it works fine.

Thanks


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.