-->
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.  [ 4 posts ] 
Author Message
 Post subject: duplicate import error
PostPosted: Fri Jul 16, 2004 5:45 am 
Newbie

Joined: Fri Apr 23, 2004 2:29 am
Posts: 12
I'm using hibernate 2.1 with Tomcat and everytime I put "class" in one-to-many or many-to-one tags, I get an hibernate error about duplicate import !

Here is my mapping file :

Code:
<hibernate-mapping package="mypackage">

    <class name="SupportClient" table="SupportClient">

        <id name="numeroSupport" type="int">
            <column name="numerosupport" sql-type="smallint" not-null="true"/>
            <generator class="uuid.hex"/>
        </id>
       
        <property name="numeroClient"  type="int">
            <column name="numeroclient" sql-type="smallint"/>
        </property>

        <property name="numeroDevis"  type="int">
            <column name="numerodevis" sql-type="smallint"/>
        </property>
       
        <property name="observation"  type="string">
            <column name="observation" sql-type="varchar(255)"/>
        </property>
       
        <many-to-one name="typeSupport" column="support"/>

        <set name="fichiersClient" inverse="true" lazy="true">
           <key column="numerosupport"/>
           <one-to-many class="FichierClient"/>
        </set>
    </class>
   
    <class name="TypeSupport" table="TypeSupport">

        <id name="code" type="int">
            <column name="codetypesupport" sql-type="smallint" not-null="true"/>
            <generator class="native"/>
        </id>
       
        <property name="designation"  type="string">
            <column name="libelletypesupport" sql-type="varchar(50)"/>
        </property>
       
    </class>

    <class name="FichierClient" table="FichierClient">

        <id name="code" type="varchar(32)">
            <column name="id" sql-type="varchar(32)" not-null="true"/>
            <generator class="native"/>
        </id>
       
       <many-to-one name="numeroSupport" column="numerosupport"/>
       
        <property name="nom"  type="string">
            <column name="nomfichier" sql-type="varchar(150)"/>
        </property>
       
    </class>

</hibernate-mapping>


The error is :
Code:
duplicate import : SupportClient


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jul 16, 2004 10:10 am 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
Check the previous logs, you'll find some better infos

_________________
Emmanuel


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jul 19, 2004 4:51 am 
Newbie

Joined: Fri Apr 23, 2004 2:29 am
Posts: 12
I use an HibernateUtil class, and I was loading configuration from an XML configuration file. It seems that it's better to use something like that :

Code:
...

Properties propsSupport = new Properties();
propsSupport.setProperty("hibernate.connection.datasource", java:comp/env/jdbc/support");
propsSupport.setProperty("hibernate.show_sql", "false");
propsSupport.setProperty("hibernate.dialect", net.sf.hibernate.dialect.SQLServerDialect");
propsSupport.setProperty("hibernate.jdbc.batch_size", "10");

Configuration cfgSupport = new Configuration()
                                 
.addClass(mypackage.SupportClient.class)
                                 
.addClass(mypackage.TypeSupport.class)
                                 
.addClass(mypackage.FichierClient.class)
                                 
.addClass(mypackage.CommandeClient.class)
                                 
.setProperties(propsSupport);
sessionFactorySupport =cfgSupport.buildSessionFactory();
...




by using this way of configuration, duplicate import error has disappeared. Before I used something like that :

Code:
...

URL configFileURLWorkplan = HibernateUtil.class.getResource("hibernateSupport.cfg.xml");
sessionFactoryWorkplan = new Configuration().configure(configFileURLSupport).buildSessionFactory();
...



Top
 Profile  
 
 Post subject:
PostPosted: Wed Jul 21, 2004 7:49 am 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
eh!
Thne you really had duplicate lines in your mapping file

_________________
Emmanuel


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 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.