I am using hibernate 2.1.3, generating classes from a db with middlegen and hbm2java. I have 2 questions related to its usage.
First, I am wondering how to tell the TypeMapper to use primitive types for my ids (int instead of java.lang.Integer), and second I was wondering if it is possible to set the id generation type somewhere in the middlegen or hbm2java tasks. I would like set the generation type to hilo instead of assigned.
Thanks.
---------------------------------------------------------------------------------
<middlegen
appname="${name}"
prefsdir="${conf.dir}"
gui="${gui}"
databaseurl="${database.url}"
driver="${database.driver}"
username="${database.userid}"
password="${database.password}"
schema="${database.schema}"
>
<table name="tblAddress" singular="Address" plural="Addresses" />
<!-- skip a few (I have 60+ tables listed here)-->
<table name="tblUserRole" singular="UserRole" plural="UserRoles"/>
<table name="tblWebFile" singular="WebFile" plural="WebFiles"/>
<!-- Plugins -->
<hibernate
destination="${gen-src.dir}"
package="com.${name}.gen"
genXDocletTags="true"
javaTypeMapper="middlegen.plugins.hibernate.HibernateJavaTypeMapper"
/>
</middlegen>
<!-- HBM2JAVA-->
<target name="hbm2java" depends="middlegen"
description="Generate .java from .hbm files.">
<taskdef
name="hbm2java"
classname="net.sf.hibernate.tool.hbm2java.Hbm2JavaTask"
classpathref="app.class.path"/>
<hbm2java config="${conf.dir}/hibernate.cfg.xml"
output="C:\cvsroot\myproject\src" classpathref="app.class.path">
<fileset dir="${gen-src.dir}">
<include name="**/*.hbm.xml" />
</fileset>
</hbm2java>
</target>
----------------------------------------------------------------------------------
|