-->
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.  [ 3 posts ] 
Author Message
 Post subject: Duplicate import error (help)
PostPosted: Mon Mar 29, 2004 1:18 pm 
Beginner
Beginner

Joined: Sat Oct 18, 2003 8:00 pm
Posts: 22
Hi

I'm trying to map an NxM relation between two entities. It's a database with systems (sistema) and users (usuarios) of this systems.

"Caused by: net.sf.hibernate.MappingException: duplicate import: Usuario"

I don't reference any map file at the code, just use the "Configuration().configure().buildSessionFactory();" command.

I have the following configuration:

<?xml version='1.0' encoding='utf-8'?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD 2.0//EN"

"http://hibernate.sourceforge.net/hibernate-configuration-2.0.dtd">

<hibernate-configuration>

<session-factory>
<property name="hibernate.connection.driver_class">oracle.jdbc.driver.OracleDriver</property>
<property name="hibernate.connection.url">jdbc:oracle:thin:@host:1521:db</property>
<property name="hibernate.connection.username">admsist</property>
<property name="hibernate.connection.password">password</property>
<property name="dialect">net.sf.hibernate.dialect.OracleDialect</property>
<property name="show_sql">true</property>
<property name="transaction.factory_class">
net.sf.hibernate.transaction.JDBCTransactionFactory
</property>
<property name="hibernate.cache.provider_class">
net.sf.hibernate.cache.HashtableCacheProvider
</property>
<property name="hibernate.hbm2ddl.auto">update</property>
<mapping resource="gov/tresc/admsist/model/Usuario.hbm.xml"/>
<mapping resource="gov/tresc/admsist/model/Sistema.hbm.xml"/>
</session-factory>
</hibernate-configuration>

Usuario.hbm.xml:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 2.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">
<hibernate-mapping>
<class name="gov.tresc.admsist.model.Usuario" table="USUARIO"
schema="ADMSIST">
<id name="id" column="IDO_USUARIO" type="long">
<generator class="increment"/>
</id>
<property name="nome" column="NOME_USUARIO" type="string"
length="70" not-null="true"/>
<property name="nome" column="NOME_USUARIO" type="string" length="70"
not-null="true"/>
<property name="login" column="LOGIN" type="string" length="70"
not-null="true"/>
<property name="eMail" column="E_MAIL" type="string" length="70"
not-null="true"/>
</class>
</hibernate-mapping>

Sistema.hbm.xml:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 2.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">
<hibernate-mapping>
<class name="gov.tresc.admsist.model.Sistema" table="SISTEMA"
schema="ADMSIST">
<id name="id" column="IDO_SISTEMA" type="long">
<generator class="increment"/>
</id>
<property name="nomeSistema" column="NOME_SISTEMA" type="string"
length="40" not-null="true"/>
<property name="estacoesAcesso" column="ESTACOES_ACESSO" type="string"
length="80"/>
<set name="usuarios" inverse="true" table="USUARIO_SISTEMA">
<key column="IDO_SISTEMA"/>
<many-to-many column="IDO_USUARIO" class="gov.tresc.admsist.model.Usuario"/>
</set>
</class>
</hibernate-mapping>


Top
 Profile  
 
 Post subject: version
PostPosted: Mon Mar 29, 2004 2:32 pm 
Beginner
Beginner

Joined: Sat Oct 18, 2003 8:00 pm
Posts: 22
I'm using Suse linux 9, Sun jdk 1.4.2 and hibernate 2.1

My query is :
List q = ServiceLocator.currentSession().createQuery("from sistema in class Sistema where sistema.id=:idsistema ");

But the error occurs when the ServiceLocator tries to configure hibernate...


Top
 Profile  
 
 Post subject:
PostPosted: Mon Mar 29, 2004 2:35 pm 
Hibernate Team
Hibernate Team

Joined: Thu Dec 18, 2003 9:55 am
Posts: 1977
Location: France
<property name="nome" column="NOME_USUARIO" type="string"
length="70" not-null="true"/>
<property name="nome" column="NOME_USUARIO" type="string" length="70"
not-null="true"/>

????
2 times the attribute? the error may be here


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