Hi all,
I'm a newbie with both Hibernate and Ant and am trying to run the tools hbm2java and hbm2ddl with Hibernate 3 and an Oracle 9 Database on a WinXP machine.
My ANT buildfile is the following:
Code:
<project name="HibernateTest" default="gencode" basedir=".">
<description>
test build file for hibernate test
</description>
<target name="init">
<!-- Create the time stamp -->
<tstamp/>
</target>
<taskdef
name="hibernatetool"
classname="org.hibernate.tool.ant.HibernateToolTask">
<classpath>
<pathelement path="${classpath}"/>
<fileset dir="E:\Java\Hibernate-3.0.5\hibernate-3.0\lib">
<include name="**/*.jar"/>
</fileset>
<fileset dir="E:\Java\Eclipse 3.1\eclipse\plugins\org.hibernate.eclipse_3.0.0.alpha4\lib">
<include name="**/*.jar"/>
</fileset>
<pathelement location="E:\Java\Hibernate-3.0.5\hibernate-3.0\hibernate3.jar"/>
<pathelement path="E:\Java\Hibernate-3.0.5\hibernate-3.0\etc"/>
</classpath>
</taskdef>
<target name="gencode">
<hibernatetool destdir="[output dir]">
<configuration configurationfile="hibernate.cfg.xml" >
<fileset dir="E:\Java\Hibernate-3.0.5\hibernate-3.0" id="config_fileset">
<include name="**/*.hbm.xml"/>
</fileset>
</configuration>
<hbm2java/>
</hibernatetool>
</target>
<target name="genshema">
<hibernatetool destdir="[output dir]">
<configuration configurationfile="hibernate.cfg.xml" >
<fileset dir="E:\Java\Hibernate-3.0.5\hibernate-3.0" id="config_fileset">
<include name="**/*.hbm.xml"/>
</fileset>
</configuration>
<hbm2ddl drop="false" outputfilename="Zonentarif.sql"/>
</hibernatetool>
</target>
</project>
My config file:
Code:
<?xml version='1.0' encoding='utf-8'?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
<session-factory>
<!-- Database connection settings -->
<property name="connection.driver_class">oracle.jdbc.OracleDriver</property>
<property name="connection.url">jdbc:oracle:thin:@mymachine:1521:mydb</property>
<property name="connection.username">dbuser</property>
<property name="connection.password">dbpwd</property>
<!-- JDBC connection pool (use the built-in) -->
<property name="connection.pool_size">1</property>
<!-- SQL dialect -->
<property name="dialect">org.hibernate.dialect.Oracle9Dialect</property>
<!-- Echo all executed SQL to stdout -->
<property name="show_sql">true</property>
<!-- Drop and re-create the database schema on startup -->
<property name="hbm2ddl.auto">create</property>
<mapping resource="test\Zonentarif.hbm.xml"/>
</session-factory>
</hibernate-configuration>
(DB-machine, instance, user and pwd substituted with placeholders for display purposes)
My resource mapping in the appropriate subfolder test looks like this:
Code:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping
package="test">
<import class="Zonentarif"/>
<class name="Zonentarif">
<comment>Zonentarif</comment>
<id name="id">
<generator class="native"/>
</id>
<natural-id>
<many-to-one name="gewKlasseID"/>
<property name="vonZoneID"/>
<property name="nachZoneID"/>
</natural-id>
</class>
</hibernate-mapping>
When I try to run this (either the hbm2java or the hbm2ddl target), I get an
Quote:
org.hibernate.MappingException: test\Zonentarif.hbm.xml not found
I've tried all kinds of path combinations that I can think of, but always get the same error. Any hints what I might be doing wrong are sincerely appreciated!