-->
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: net.sf.hibernate.MappingException: duplicate import: Product
PostPosted: Thu Dec 04, 2003 2:27 pm 
Newbie

Joined: Thu Dec 04, 2003 2:19 pm
Posts: 6
I am using a config file and no EJB etc
Castor works for me but not Hibernate I'd like to use hibernate cause of the rich feature set.

Exception


et.sf.hibernate.MappingException: Error reading resource: test/mapping.xml
at net.sf.hibernate.cfg.Configuration.addResource(Configuration.java:292)
at net.sf.hibernate.cfg.Configuration.configure(Configuration.java:933)
at net.sf.hibernate.cfg.Configuration.configure(Configuration.java:885)
at net.sf.hibernate.cfg.Configuration.configure(Configuration.java:823)
at test.Test.doCreateOrGetHibernate(Test.java:83)
at test.Test.testhibernateJDO(Test.java:64)
at test.Test.main(Test.java:21)
Caused by: net.sf.hibernate.MappingException: duplicate import: Products
at net.sf.hibernate.cfg.Mappings.addImport(Mappings.java:68)
at net.sf.hibernate.cfg.Binder.bindClass(Binder.java:120)
at net.sf.hibernate.cfg.Binder.bindRootClass(Binder.java:184)
at net.sf.hibernate.cfg.Binder.bindRoot(Binder.java:1146)
at net.sf.hibernate.cfg.Configuration.add(Configuration.java:243)
at net.sf.hibernate.cfg.Configuration.addInputStream(Configuration.java:266)
at net.sf.hibernate.cfg.Configuration.addResource(Configuration.java:289)
... 6 more
New Null Objec



Configuration cf = new Configuration();
cf.configure("/test.cfg.xml");
//never goes past above line

SessionFactory sf = cf.buildSessionFactory();


Configuration file:
<hibernate-configuration>

<session-factory>

<property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property>
<property name="hibernate.connection.url">jdbc:mysql://nyeqegen1lxp02.lehman.com:3306/infra?autoReconnect=true</property>
<property name="hibernate.connection.username">root</property>
<property name="hibernate.connection.password">lehman</property>
<property name="show_sql">false</property>
<property name="dialect">net.sf.hibernate.dialect.MySQLDialect</property>

<!-- Mapping files -->
<mapping resource="test/mapping.xml"/>

</session-factory>

</hibernate-configuration>




Mapping FIle:
<?xml version="1.0"?>

<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 2.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">

<hibernate-mapping>
<class
name="test.Products"
table="NAMES"
dynamic-update="false"
dynamic-insert="false"
>

<id
name="symbol"
column="NAME"
type="String"
length=""
unsaved-value="null"
>
<generator class="">
</generator>
</id>

<property
name="exchange"
type="String"
update="true"
insert="true"
column="EXCHANGE"
not-null="false"
unique="false"
/>

<property
name="blade"
type="String"
update="true"
insert="true"
column="BLADE"
not-null="false"
unique="false"
/>

<property
name="bin"
type="int"
update="true"
insert="true"
column="BIN"
not-null="false"
unique="false"
/>

<property
name="interface"
type="String"
update="true"
insert="true"
column="INTERFACE"
not-null="false"
unique="false"
/>

<property
name="region"
type="String"
update="true"
insert="true"
column="REGION"
not-null="false"
unique="false"
/>

<property
name="binmachine"
type="String"
update="true"
insert="true"
column="BINMACHINE"
not-null="false"
unique="false"
/>


</class>

</hibernate-mapping>


Top
 Profile  
 
 Post subject:
PostPosted: Fri Dec 05, 2003 2:30 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 7:19 pm
Posts: 2364
Location: Brisbane, Australia
Have a look at the tools workshop as this shows directory structures and various xml configuration files which should provide enough information for you. Its in the example http://hibernate.bluemars.net/159.html


Top
 Profile  
 
 Post subject:
PostPosted: Fri Dec 05, 2003 10:08 am 
Newbie

Joined: Thu Dec 04, 2003 2:19 pm
Posts: 6
Thanks I had syntax errors in the mapping file.

Its throwing a misleading exception thats the problem.

Its going ot be addressed once I set up a JIRA or something...


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.