Thank you for the reference
.. I'm still unable to generate the java files..
This is what I've done
--- I've downloaded Hibernate Tools from
http://www.hibernate.org/30.html
--I've extracted hibernatetools-3.1.0.beta5.zip and
copied plugins/\org.hibernate.eclipse_3.1.0.beta5\lib\tools\hibernate-tools.jar into my project's lib folder and added it to my project.
--Here are the code files I've used
build.xml:
<target name="hibernatetool">
<path id="toolslib">
<path location="lib/hibernate-tools.jar" />
<path location="lib/hibernate3.jar" />
<path location="lib/freemarker.jar" />
<path location="${jdbc.driver.jar}" />
<path location="${jdbc.driver.jar}" />
<path location="lib\antlr-2.7.5H3.jar" />
<path location="lib\cglib-nodep-2.1_3.jar" />
<path location="lib\commons-beanutils.jar" />
<path location="lib\commons-collections.jar" />
<path location="lib\commons-dbcp.jar" />
<path location="lib\commons-digester-1.5.jar" />
<path location=";lib\commons-lang-2.0.jar" />
<path location="lib\commons-lang.jar" />
<path location="lib\commons-logging.jar" />
<path location="lib\commons-logging-api.jar;" />
<path location="lib\commons-pool.jar;" />
<path location="lib\db-ojb-1.0.3.jar;" />
<path location="lib\dom4j-1.6.jar" />
<path location="lib\ehcache-1.1.jar" />
<path location="lib\jstl.jar" />
<path location="lib\jta.jar" />
<path location="lib\mysql-connector-java-3.0.15-ga-bin.jar" />
<path location="lib\standard.jar" />
<path location="." />
</path>
<taskdef name="hibernatetool"
classname="org.hibernate.tool.ant.HibernateToolTask"
classpathref="toolslib" />
<hibernatetool destdir="javafiles">
<configuration configurationfile="hibernate.cfg.xml"/>
<hbm2java />
</hibernatetool>
</target>
The Configuration File(hibernate.cfg.xml):
<?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">com.mysql.jdbc.Driver</property>
<property name="connection.username">root</property>
<property name="connection.password"></property>
<!-- JDBC connection pool (use the built-in) -->
<property name="connection.pool_size">10</property>
<!-- SQL dialect -->
<property name="dialect">org.hibernate.dialect.MySQLDialect</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="Airspace.hbm.xml"/>
<!-- <mapping resource="Airport.hbm.xml"/>
<mapping resource="Runway.hbm.xml"/>
<mapping resource="Signal.hbm.xml"/> -->
<!--<mapping resource="DPRData.hbm.xml"/>-->
</session-factory>
</hibernate-configuration>
The mapping File (Airspace.hbm.xml):
<?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>
<class entity-name="Airspace">
<id name="id" type="long" column="ID"/>
<property name="name" type="string" column="NAME"/>
<property name="area" type="string" column="AREA"/>
<property name="country" type="string" column="COUNTRY"/>
<property name="entityType" type="string" column="ENTITYTYPE"/>
</class>
</hibernate-mapping>
Kindly look into it and lemme know what could be the problem.. I get a NullPointerException when I try to run my build file.