Joined: Mon Nov 28, 2005 10:09 am Posts: 11
|
I'm trying to run an hbm2java ant task. But I got an exception(DuplicateMappingException)
build.xml :
-------------------------------------------------
<?xml version="1.0"?>
<project name="helloWorld" basedir="src" default="pojo">
<property name="src.dir" value="."/>
<property name="build.dir" value="."/>
<property name="jdbc.driver.jar" value="C:/Program Files/Microsoft SQL Server 2000 Driver for JDBC/lib/*.*"/>
<property name="code.java.dir" value="D:/code.java"/>
<property name="hbmtools.dir" value="${code.java.dir}/hibernate-tools/lib/tools"/>
<property name="hbm.dir" value="${code.java.dir}/hibernate-3.2"/>
<path id="toolslib">
<path location="."/>
<path location="${src.dir}"/>
<path location="${build.dir}"/>
<path location="${code.java.dir}/hibernate-3.2/hibernate3.jar"/>
<path location="${hbmtools.dir}/hibernate-tools.jar"/>
<path location="${hbmtools.dir}/freemarker.jar"/>
<path location="${hbmtools.dir}/jtidy-r8-21122004.jar"/>
<path location="${hbm.dir}/lib/dom4j-1.6.1.jar"/>
<path location="${hbm.dir}/lib/log4j-1.2.11.jar"/>
<path location="${hbm.dir}/lib/commons-logging-1.0.4.jar"/>
<path location="${hbm.dir}/lib/commons-collections-2.1.1.jar"/>
<path location="${hbm.dir}/lib/cglib-2.1.3.jar"/>
<path location="${hbm.dir}/lib/ehcache-1.1.jar"/>
<path location="${hbm.dir}/lib/jta.jar"/>
<path location="${jdbc.driver.jar}"/>
</path>
<taskdef name="hibernatetool"
classname="org.hibernate.tool.ant.HibernateToolTask"
classpathref="toolslib"/>
<target name="pojo" description="generate java pojo classes with hbm2java">
<hibernatetool destdir="${build.dir}">
<configuration configurationfile="${src.dir}/hibernate.cfg.xml">
<fileset dir="${src.dir}">
<include name="**/*.hbm.xml"/>
</fileset>
</configuration>
<hbm2java/>
</hibernatetool>
</target>
</project>
-------------------------------------------------
hibernate.cfg.xml :
-------------------------------------------------
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD 3.1//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
<session-factory>
<property name="hibernate.connection.driver_class">com.microsoft.jdbc.sqlserver.SQLServerDriver</property>
<property name="hibernate.connection.url">jdbc:microsoft:sqlserver://florence:1433;DatabaseName=AQM</property>
<property name="hibernate.connection.username">sa</property>
<property name="hibernate.connection.password"></property>
<property name="hibernate.connection.pool_size">10</property>
<property name="show_sql">true</property>
<property name="dialect">org.hibernate.dialect.SQLServerDialect</property>
<!--<property name="query.factory_class">org.hibernate.hql.classic.ClassicQueryTranslatorFactory</property>-->
<mapping resource="aria/Window.hbm.xml"/>
</session-factory>
</hibernate-configuration>
-------------------------------------------------
Window.hbm.xml
-------------------------------------------------
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping package="aria">
<class name="WindowTO" table="window">
<id name="id" column="id" type="java.lang.Integer">
<generator class="native"/>
</id>
<property name="keypad_address" column="keypad_address" type="java.lang.Integer" />
<property name="led_address" column="led_address" type="java.lang.Integer" />
<property name="deleted" column="deleted" type="java.lang.Boolean" />
<property name="code" column="code" type="java.lang.Integer" />
<property name="title" column="title" type="java.lang.String" />
<property name="password" column="password" type="java.lang.String" />
<property name="active" column="active" type="java.lang.Boolean" />
<property name="isSoftware" column="issoftware" type="java.lang.Boolean" />
<property name="type" column="type" type="java.lang.Boolean" />
</class>
</hibernate-mapping>
-------------------------------------------------
I got the output:
An exception occured while running exporter #2:hbm2java (Generates a set of .java files)
Failed in building configuration when adding D:\DevDesk\hibernateToolsTest\src\aria\Window.hbm.xml
org.hibernate.MappingException: Could not read mapping document from file: D:\DevDesk\hibernateToolsTest\src\aria\Window.hbm.xml
org.hibernate.DuplicateMappingException: Duplicate class/entity mapping aria.WindowTO
D:\DevDesk\hibernateToolsTest\build.xml:33: Failed in building configuration when adding D:\DevDesk\hibernateToolsTest\src\aria\Window.hbm.xml
I tried to find a documentation resource for DuplicateMappingException, without any success.
What's my mistake?
<Farshid/>
|
|