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.  [ 5 posts ] 
Author Message
 Post subject: net.sf.hibernate.MappingException: duplicate import
PostPosted: Tue Oct 28, 2003 2:56 pm 
Newbie

Joined: Wed Oct 22, 2003 1:07 pm
Posts: 10
Hi,
I am gettiing this error while trying to open the SessionFactory

SessionFactory sessionFtryNewDb = new Configuration().configure("/hibernate_astronomy.cfg.xml").buildSessionFactory();

net.sf.hibernate.MappingException: duplicate import; StudentUnitDtl

and here is my hibernate_astronomy.cfg.xml file-

<?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="connection.datasource">java:comp/env/jdbc/astronomyDS</property>
<property name="show_sql">false</property>
<property name="dialect">net.sf.hibernate.dialect.SybaseDialect</property>

<mapping resource="edu/sc/asg/astronomy/persistence/CourseEnrollment.hbm.xml" auto-import="false"/>
<mapping resource="edu/sc/asg/astronomy/persistence/Students.hbm.xml" auto-import="false"/>
<mapping resource="edu/sc/asg/astronomy/persistence/StudentUnitDtl.hbm.xml" auto-import="false"/>
<mapping resource="edu/sc/asg/astronomy/persistence/Courses.hbm.xml" auto-import="false"/>
<mapping resource="edu/sc/asg/astronomy/persistence/StudentUnitStatus.hbm.xml" auto-import="false"/>
<mapping resource="edu/sc/asg/astronomy/persistence/Units.hbm.xml" auto-import="false"/>
<mapping resource="edu/sc/asg/astronomy/persistence/CourseCreditUnits.hbm.xml" auto-import="false"/>

</session-factory>

</hibernate-configuration>

and here is StudetUnitDtl.hbm.xml
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd" >

<hibernate-mapping>

<!--
Created by Middlegen Hibernate plugin

http://boss.bekk.no/boss/middlegen/
http://hibernate.sourceforge.net/
-->

<class
name="edu.sc.asg.astronomy.persistence.StudentUnitDtl"
table="student_unit_dtl"
>
<id
name="studentUnitDtlId"
type="int"
column="student_unit_dtl_id"
>
<generator class="identity" />
</id>
<property
name="statusDt"
type="java.sql.Timestamp"
column="status_dt"
length="23"
/>
<property
name="completedUnitFlg"
type="java.lang.String"
column="completed_unit_flg"
not-null="true"
length="1"
/>

<!-- associations -->
<!-- bi-directional one-to-many association to CourseCreditUnit -->
<set
name="courseCreditUnits"
lazy="true"
inverse="true"
>
<key>
<column name="student_unit_dtl_id" />
</key>
<one-to-many
class="edu.sc.asg.astronomy.persistence.CourseCreditUnit"
/>
</set>
<!-- bi-directional many-to-one association to Student -->
<many-to-one
name="student"
class="edu.sc.asg.astronomy.persistence.Students"
not-null="true"
>
<column name="student_id" />
</many-to-one>
<!-- bi-directional many-to-one association to Units -->
<many-to-one
name="unit"
class="edu.sc.asg.astronomy.persistence.Units"
not-null="true"
>
<column name="unit_id" />
</many-to-one>
<!-- bi-directional many-to-one association to StudentUnitStatus -->
<many-to-one
name="studentUnitStatus"
class="edu.sc.asg.astronomy.persistence.StudentUnitStatus"
not-null="true"
>
<column name="student_unit_status_id" />
</many-to-one>

</class>
</hibernate-mapping>


Top
 Profile  
 
 Post subject:
PostPosted: Tue Oct 28, 2003 3:08 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 3:00 pm
Posts: 1816
Location: Austin, TX
Turn logging to DEBUG and see which mapping file it is working on when it chokes.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Oct 28, 2003 4:02 pm 
Newbie

Joined: Wed Oct 22, 2003 1:07 pm
Posts: 10
where do you set the logging level to debug?


Top
 Profile  
 
 Post subject:
PostPosted: Tue Oct 28, 2003 4:14 pm 
Newbie

Joined: Wed Oct 22, 2003 1:07 pm
Posts: 10
I got it. One class name for a relationship was not correct in one mapping file.
Thanks Anyway.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Nov 12, 2003 4:32 pm 
Newbie

Joined: Sun Oct 26, 2003 9:59 am
Posts: 2
I have a identical problem.

When I use Middlegen to generate the hibernate descriptors with relationships, in the many-to-one, they are generated without attributes update="false" insert="false".

What I need for works fine?
There are a correction for this litle bug ?

Thanks

[]s, Welington B. Souza


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