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: duplicate import
PostPosted: Thu Jan 12, 2006 9:35 am 
Regular
Regular

Joined: Wed Sep 21, 2005 1:37 pm
Posts: 53
Location: Montpellier - France
I have a duplicate import error when opening the session but I don't see what is duplicated.

Hibernate version: 3

Mapping documents:
<hibernate-configuration>
<session-factory>
<property name="hibernate.connection.driver_class">org.hsqldb.jdbcDriver</property>
<property name="hibernate.connection.url">jdbc:hsqldb:hsql://localhost:1701</property>
<property name="hibernate.dialect">org.hibernate.dialect.HSQLDialect</property>
<property name="hibernate.show_sql">true</property>
<property name="hibernate.hbm2ddl.auto">update</property>
<property name="hibernate.cache.provider_class">org.hibernate.cache.EhCacheProvider</property>
<property name="hibernate.cache.use_query_cache">true</property>

<mapping resource="org/infodavid/data/entities/rc/City.hbm.xml" />
</session-factory>
</hibernate-configuration>

and

<hibernate-mapping package="org.infodavid.data.entities" auto-import="true" default-access="property">
<!-- CityBMP -->
<class name="CityBMP" table="CITIES">
<composite-id name="key" class="org.infodavid.data.client.CityPK">
<key-property name="code" column="code" type="java.lang.String"/>
<key-property name="country" column="country" type="java.lang.String"/>
</composite-id>
<version name="version" column="version" type="java.lang.Integer"/>
<property name="name" column="name" type="java.lang.String" not-null="true"/>
</class>
<query name="city.findByPrimaryKey">select key from CityBMP where code = ? and country = ? order by code, name, country</query>
<query name="city.findByName">select key from CityBMP where name like ? order by code, country</query>
<query name="city.findAll">select key from CityBMP order by code, country</query>
</hibernate-mapping>

Full stack trace of any exception that occurs:
2006-01-12 14:29:59,591 INFO [org.hibernate.cfg.Configuration] configuring from resource: /META-INF/hibernate.cfg.xml
2006-01-12 14:29:59,591 INFO [org.hibernate.cfg.Configuration] Configuration resource: /META-INF/hibernate.cfg.xml
2006-01-12 14:29:59,591 DEBUG [org.hibernate.util.DTDEntityResolver] trying to locate http://hibernate.sourceforge.net/hibern ... on-3.0.dtd in classpath under org/hibernate/
2006-01-12 14:29:59,591 DEBUG [org.hibernate.util.DTDEntityResolver] found http://hibernate.sourceforge.net/hibern ... on-3.0.dtd in classpath
2006-01-12 14:29:59,591 DEBUG [org.hibernate.cfg.Configuration] hibernate.connection.driver_class=org.hsqldb.jdbcDriver
2006-01-12 14:29:59,591 DEBUG [org.hibernate.cfg.Configuration] hibernate.connection.url=jdbc:hsqldb:hsql://localhost:1701
2006-01-12 14:29:59,591 DEBUG [org.hibernate.cfg.Configuration] hibernate.dialect=org.hibernate.dialect.HSQLDialect
2006-01-12 14:29:59,591 DEBUG [org.hibernate.cfg.Configuration] hibernate.show_sql=true
2006-01-12 14:29:59,591 DEBUG [org.hibernate.cfg.Configuration] hibernate.hbm2ddl.auto=update
2006-01-12 14:29:59,591 DEBUG [org.hibernate.cfg.Configuration] hibernate.cache.provider_class=org.hibernate.cache.EhCacheProvider
2006-01-12 14:29:59,591 DEBUG [org.hibernate.cfg.Configuration] hibernate.cache.use_query_cache=true
2006-01-12 14:29:59,591 DEBUG [org.hibernate.cfg.Configuration] null<-org.dom4j.tree.DefaultAttribute@f0d3a6 [Attribute: name resource value "org/infodavid/data/entities/rc/City.hbm.xml"]
2006-01-12 14:29:59,591 INFO [org.hibernate.cfg.Configuration] Reading mappings from resource: org/infodavid/data/entities/rc/City.hbm.xml
2006-01-12 14:29:59,607 DEBUG [org.hibernate.util.DTDEntityResolver] trying to locate http://hibernate.sourceforge.net/hibern ... ng-3.0.dtd in classpath under org/hibernate/
2006-01-12 14:29:59,607 DEBUG [org.hibernate.util.DTDEntityResolver] found http://hibernate.sourceforge.net/hibern ... ng-3.0.dtd in classpath
2006-01-12 14:29:59,607 INFO [org.hibernate.cfg.Mappings] duplicate import: org.infodavid.data.entities.CityBMP->org.infodavid.data.entities.CityBMP
2006-01-12 14:29:59,607 INFO [org.hibernate.cfg.Mappings] duplicate import: org.infodavid.data.entities.CityBMP->CityBMP
2006-01-12 14:29:59,607 INFO [org.hibernate.cfg.HbmBinder] Mapping class: org.infodavid.data.entities.CityBMP -> CITIES
2006-01-12 14:29:59,607 DEBUG [org.hibernate.cfg.HbmBinder] Mapped property: code -> code
2006-01-12 14:29:59,607 DEBUG [org.hibernate.cfg.HbmBinder] Mapped property: country -> country
2006-01-12 14:29:59,607 DEBUG [org.hibernate.cfg.HbmBinder] Mapped property: key -> code, country
2006-01-12 14:29:59,607 DEBUG [org.hibernate.cfg.HbmBinder] Mapped property: version -> version
2006-01-12 14:29:59,607 DEBUG [org.hibernate.cfg.HbmBinder] Mapped property: name -> name
2006-01-12 14:29:59,607 INFO [STDOUT] org.hibernate.MappingException: Could not read mappings from resource: org/infodavid/data/entities/rc/City.hbm.xml
at org.hibernate.cfg.Configuration.addResource(Configuration.java:483)

Name and version of the database you are using:
Hypersonic for tests


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jan 12, 2006 10:32 am 
Regular
Regular

Joined: Wed Sep 21, 2005 1:37 pm
Posts: 53
Location: Montpellier - France
found the error :

<composite-id name="key" class="org.infodavid.data.client.CityPK">

'key' must be 'primaryKey' but I don"t understand the message talking about duplicated elements....


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.