Hello,
I wanted to try recent java 5.0 DAO generation with Hibernate tools. I've
downloaded latest night build. Can you, please, point me
what should I put into my ant build.xml for DAO generation
(those DAOs which use generics)?
Thanks,
Code:
<?xml version="1.0"?>
<project name="HibernateTool Generator" default="hbm2x">
<property name="my.root.dir" value="${basedir}"/>
<property name="src.dir" value="${basedir}/src"/>
<property name="hbm.cfg.dir" value="${basedir}/src"/>
<path id="classpath">
<pathelement location="${basedir}"/>
<fileset dir="${basedir}/lib">
<include name="**/*.jar"/>
</fileset>
</path>
<!-- =================================================================== -->
<!-- Generates java source code from hibernate mappings (*.hbm.xml) -->
<!-- =================================================================== -->
<target name="hbm2x" description="Generate java source code from hibernate mappings">
<taskdef name="hibernatetool" classname="org.hibernate.tool.ant.HibernateToolTask" classpathref="classpath"/>
<hibernatetool destdir="${basedir}/src">
<configuration configurationfile="${hbm.cfg.dir}/hibernate-iocm.cfg.xml">
<fileset dir="${basedir}/src">
<!-- A configuration can take a configurationfile and/or a fileset of hbm.xml's -->
<include name="**/*.hbm.xml"/>
</fileset>
</configuration>
<!-- code generation -->
<hbm2java generics="true"/>
<!-- code generation with custom templates (yes, can run each task more than once! -->
<hbm2java templatespath="${basedir}/velocity/dao"/>
<!-- Generate documentation -->
<hbm2doc/>
<!-- Generate DAOs -->
<!--
<hbm2dao/>
-->
<!-- Generate JSF -->
<!--
<hbm2jsf/>
-->
<!-- Schema export -->
<hbm2ddl drop="false" format="true" outputfilename="db-init.sql"/>
</hibernatetool>
</target>
</project>