Hibernate Tools version: 3.1.0 Beta 4
I have the following code that's produced by Middlegen 2.1 (I know it's old school, but I don't believe the Hibernate Tools project supports generating XDoclet-enhanced POJOs).
Code:
<id
name="catId"
type="java.lang.Integer"
column="cat_id"
>
<meta attribute="field-description">
@hibernate.id
generator-class="native"
type="java.lang.Integer"
column="cat_id"
</meta>
<meta attribute="use-in-equals">true</meta>
<generator class="native" />
</id>
When I use hbm2java, I end up with the XDoclet tags on my fields, as well as my getter methods. Is it possible to exclude them from the fields w/o hacking the Velocity template? Here's what I've done to exclude them for now. Changed PojoFields.vm from:
Code:
#foreach($field in $pojo.getAllPropertiesIterator())
#if($pojo.getMetaAttribAsBool($field, "gen-property", true))
#if($pojo.hasMetaAttribute($field, "field-description"))
/**
$pojo.getFieldJavaDoc($field,0)
*/
#end
$pojo.getFieldModifiers($field) $pojo.getJavaTypeName($field, $jdk5) $field.name#if($pojo.hasFieldInitializor($field, $jdk5)) = $pojo.getFieldInitialization($field, $jdk5)#end;
#end
#end
To:
Code:
#foreach($field in $pojo.getAllPropertiesIterator())
#if($pojo.getMetaAttribAsBool($field, "gen-property", true))
$pojo.getFieldModifiers($field) $pojo.getJavaTypeName($field, $jdk5) $field.name#if($pojo.hasFieldInitializor($field, $jdk5)) = $pojo.getFieldInitialization($field, $jdk5)#end;
#end
#end
Is there a more elegant solution?