-->
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.  [ 1 post ] 
Author Message
 Post subject: there are no duplicates!
PostPosted: Fri Apr 01, 2005 5:40 am 
Newbie

Joined: Mon Feb 02, 2004 4:18 pm
Posts: 16
I've got two classes called "Schedule" but in two different packages. I can use both with hibernate as long as they are in different sessionFactories, but when I try to generate the schema or use a single factory then hibernate tells me that there is a duplicate import. Does hibernate only use the class name and not the package name for the entity?

Read the rules before posting!
http://www.hibernate.org/ForumMailingli ... AskForHelp

Hibernate version:2.1

Mapping documents: mapping a

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

<hibernate-mapping package="package1">
<class name="Schedule" table="SCHEDULE" dynamic-update="false"
dynamic-insert="false" select-before-update="false"
optimistic-lock="version">

<id name="id" column="SCHEDULE_ID" type="long"
unsaved-value="-1">
<generator class="native" />
</id>

<property name="contentProvider" type="java.lang.String"
update="true" insert="true" access="property"
column="CONTENT_PROVIDER" not-null="true" />


<list name="items" lazy="false" inverse="false"
cascade="all-delete-orphan">
<key column="SCHEDULE_ID" />
<index column="POSITION" type="int" />
<one-to-many class="uk.co.telewest.vod.qa.bo.ScheduleItem" />
</list>

<property name="ingestDate" type="java.util.Date" update="true"
insert="true" access="property" column="SCHEDULE_INGEST_DATE"
not-null="true" />

<property name="startDate" type="java.util.Date" update="true"
insert="true" access="property" column="SCHEDULE_START_DATE"
not-null="true" />
</class>

</hibernate-mapping>

mapping 2:

<hibernate-mapping package="package2">
<class name="Schedule"
table="BARKER_SCHEDULE">

<id name="scheduleId" column="id" type="java.lang.Integer">
<generator class="native" />
</id>
<property name="timestamp" type="java.util.Date"
column="SCHEDULE_START_DATE" not-null="true" />
</class>

</hibernate-mapping>


Code between sessionFactory.openSession() and session.close(): n/a

Full stack trace of any exception that occurs:
net.sf.hibernate.MappingException: duplicate import: Schedule
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:1256)
at net.sf.hibernate.cfg.Configuration.add(Configuration.java:253)
at net.sf.hibernate.cfg.Configuration.addFile(Configuration.java:175)
at net.sf.hibernate.tool.hbm2ddl.SchemaExportTask.getConfiguration(SchemaExportTask.java:195)
at net.sf.hibernate.tool.hbm2ddl.SchemaExportTask.execute(SchemaExportTask.java:135)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:269)
at org.apache.tools.ant.Task.perform(Task.java:364)
at org.apache.tools.ant.Target.execute(Target.java:301)
at org.apache.tools.ant.Target.performTasks(Target.java:328)
at org.apache.tools.ant.Project.executeTarget(Project.java:1215)
at org.apache.tools.ant.Project.executeTargets(Project.java:1063)
at org.apache.tools.ant.Main.runBuild(Main.java:632)
at org.apache.tools.ant.Main.startAnt(Main.java:183)
at org.apache.tools.ant.launch.Launcher.run(Launcher.java:197)
at org.apache.tools.ant.launch.Launcher.main(Launcher.java:56)


Name and version of the database you are using:mysql4

The generated SQL (show_sql=true):

Debug level Hibernate log excerpt:


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

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.