Hi,
I'm trying to set-up some Ant scripts to run the Hibernate Tools in Eclipse 3.0.2. This should be alright, since the Ant tools are independent of Eclipse platform right?
Here's my hibernate.cfg.xml file:
Code:
<hibernate-configuration>
<session-factory>
<!--
Database connection details: use either JNDI datasource or local driver
1. Using JNDI datasource: set the JNDI reference
<property name="connection.datasource">java:comp/env/jdbc/DEV</property>
2. Local connection
//-->
<property name="connection.datasource">t3://127.0.0.1:7001/jdbc/DEV</property>
<!--
dialects
SQL Server: net.sf.hibernate.dialect.SQLServerDialect
Oracle 9/10g: net.sf.hibernate.dialect.Oracle9Dialect
MySQL: net.sf.hibernate.dialect.MySQLDialect
//-->
<property name="dialect">
org.hibernate.dialect.SQLServerDialect
</property>
<!--
Transaction parameters
hibernate.transaction.factory_class: either "org.hibernate.transaction.JTATransactionFactory"
or "org.hibernate.transaction.JDBCTransactionFactory"
hibernate.transaction.manager_lookup_class: "org.hibernate.transaction.WeblogicTransactionManagerLookup"
for Weblogic
jta.UserTransaction: The JNDI name for the JTA User Transaction
Example:
<property name="hibernate.transaction.factory_class">org.hibernate.transaction.JTATransactionFactory</property>
<property name="hibernate.transaction.manager_lookup_class">org.hibernate.transaction.WeblogicTransactionManagerLookup</property>
<property name="jta.UserTransaction">t3://127.0.0.1:7001/javax/transaction/UserTransaction</property>
//-->
<property name="hibernate.transaction.factory_class">
net.sf.hibernate.transaction.JDBCTransactionFactory
</property>
<!--
Other parameters
hibernate.connection.isolation: 0=NONE, 1=READ_UNCOMMITTED, 2=READ_COMMITTED, 4=REPEATABLE_READS, 8=SERIALIZABLE
//-->
<property name="hibernate.show_sql">true</property>
<property name="hibernate.max_fetch_depth">1</property>
<property name="hibernate.jdbc.fetch_size">10</property>
<property name="hibernate.jdbc.batch_size">20</property>
<property name="hibernate.jdbc.use_streams_for_binary">true</property>
<property name="hibernate.jdbc.batch_size">20</property>
<property name="hibernate.connection.isolation">2</property>
<!-- Mappings file references for your Java objects -->
<mapping resource="project/vo/User.hbm.xml" />
Here's my Ant script:
Code:
<project name="Hibernate Tools" default="init" basedir=".">
<taskdef name="hibernatetool"
classname="org.hibernate.tool.ant.HibernateToolTask"
classpath="../supportJARs/hibernateTools/hibernate-tools.jar;
../supportJARs/hibernateTools/velocity-1.4.jar;
../supportJARs/hibernateTools/velocity-tools-generic-1.1.jar;
../supportJARs/hibernateTools/jtidy-r8-21122004.jar;
../supportJARs/hibernateTools/hibernate3.jar;
../supportJARs/jdts-1.0.jar;
../supportJARs/lib/commons-logging-1.0.4.jar;
../supportJARs/lib/dom4j-1.4.jar;
../supportJARs/lib/commons-collections-2.1.1.jar"
/>
<target name="init">
</target>
<target name="generateJava" depends="init">
<hibernatetool destdir="..src">
<configuration configurationfile="..src/hibernate.cfg.xml" />
<hbm2java/>
</hibernatetool>
The Ant script is in a folder called "deploy", which is at the same level as the folder "src", where the source files and the Hibernate XMLs are.
When I tried to run the script, I got this complaint from Ant:
BUILD FAILED: F:\Eclipse Project (New)\Hibernate\deploy\build_HibernateTools.xml
:20: org.hibernate.MappingException: Resource: project/vo/User.hbm.xml not found
Seems like a pathing issue. Any ideas how I can configure this up properly?
Thanks in advance for any advice!