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!
|
|