-->
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.  [ 2 posts ] 
Author Message
 Post subject: hbm2ddl ant task - duplicate import error
PostPosted: Thu Nov 13, 2003 9:56 am 
Beginner
Beginner

Joined: Thu Oct 09, 2003 11:41 am
Posts: 39
Location: Paris, France
Hi,

Problem: cannot get hbm2ddl to generate mappings for two classes with the same class names but located in different packages

I have the following hbm2ddl ant task:

<!-- ant task -->
<target name="hbm2ddl">

<javac srcdir="${src.dir}" destdir="${build.dir}" classpathref="libs" nowarn="off" />

<copy todir="${build.dir}">
<fileset dir="${src.dir}"><include name="*.hbm.xml"/></fileset>
</copy>

<schemaexport config="/hibernate.cfg.xml" quiet="yes" text="yes" drop="no" delimiter=";" output="schema-export.sql"/>

</target>

Suppose I have one hbm.xml mapping as follows:

<!-- my_package.Department mapping -->
<hibernate-mapping>

<class name="my_package.Department" table="my_department">
...etc...
</class>

</hibernate-mapping>

If I run the ant task against a second mapping as follows:

<!-- my_package.accounting.Department mapping -->

<hibernate-mapping>

<class name="my_package.accounting.Department" table="my_accounting_department">
...etc...
</class>

</hibernate-mapping>

I get the following error:
Schema text failed: duplicate import: Department

If I change my_package.accounting.Department for my_package.accounting.BlahDepartment , everything is generated correctly, provided the class is compiled.

Am I doing something wrong or is it the way it's supposed to be? I would much prefer to be able to have the same class names in different packages mapped to different tables as in my non-working example (my_package.Department and my_package.accounting.Department)

Thanks!


Top
 Profile  
 
 Post subject:
PostPosted: Thu Nov 13, 2003 10:12 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
This is covered in the Hibernate manual.

Please see the coverage of the <import/> element and auto-import attribute.


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