-->
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: composite-id returns "duplicate import" error
PostPosted: Fri Jul 09, 2004 5:29 am 
Newbie

Joined: Fri Apr 23, 2004 2:29 am
Posts: 12
I'm using hibernate 2.1 and it works fine. But now, I try to map an existing table from an existing database.
Voici la structure de ma table :

here is the structure of the FOO table :
Code:
create table FOO (
   id1 smallint not null,
   id2 smallint not null,
   id3 char(2) not null,
   id4 char(3) not null,
   primary key (id1, id2, id3, id4)
)



and the mapping file

Code:
<hibernate-mapping>
   <class name="mypackage.Foo" table="FOO">
        <composite-id name="compId" class="mypackage.FooCompositeID>
           <key-property name="id1" column="id1" type="int"/>
           <key-property name="id2" column="id2" type="int"/>
           <key-property name="id3" column="id3" type="string"/>
           <key-property name="id4" column="id4" type="string"/>
        </composite-id>
    </class>
</hibernate-mapping>


It returns this error :

Code:
Caused by: java.lang.RuntimeException: Exception building SessionFactory: Error reading resource: monpaquetage/hibernate/Toto.hbm.xml
        at monpaquetage.hibernate.HibernateUtil.<clinit>(HibernateUtil.java:45)
        ... 33 more
Caused by: net.sf.hibernate.MappingException: Error reading resource: monpaquetage/hibernate/Toto.hbm.xml
        at net.sf.hibernate.cfg.Configuration.addResource(Configuration.java:318)
        at net.sf.hibernate.cfg.Configuration.doConfigure(Configuration.java:976)
        at net.sf.hibernate.cfg.Configuration.doConfigure(Configuration.java:928)
        at net.sf.hibernate.cfg.Configuration.configure(Configuration.java:871)
        at monpaquetage.hibernate.HibernateUtil.<clinit>(HibernateUtil.java:42)
        ... 33 more
Caused by: net.sf.hibernate.MappingException: duplicate import: MapToto
        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.bindRootClass(Binder.java:221)
        at net.sf.hibernate.cfg.Binder.bindRoot(Binder.java:1229)
        at net.sf.hibernate.cfg.Configuration.add(Configuration.java:249)
        at net.sf.hibernate.cfg.Configuration.addInputStream(Configuration.java:285)
        at net.sf.hibernate.cfg.Configuration.addResource(Configuration.java:315)
        ... 37 more


The class "FooCompositeID" implements Serializable and overrides hashCode() and equals()


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jul 09, 2004 5:32 am 
Newbie

Joined: Fri Apr 23, 2004 2:29 am
Posts: 12
Since I've changed my mapping file (different class name), now the error is :

Code:
...
duplicate import : Foo
...


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.