hibernate tools 生成Pojo 注解 模板修改
1.修改注解位置(原为get/set方法上方,改为属性声明上方)
解压hibernate-tools.jar,修改hibernate-tools\pojo\PojoFields.ftl文件,(整字匹配)替换field为property;打开hibernate-tools\pojo\PojoPropertyAccessors.ftl,剪切<#include "GetPropertyAnnotation.ftl"/>到${pojo.getFieldModifiers(property)}...上一行
<#foreach property in pojo.getAllPropertiesIterator()><#if pojo.getMetaAttribAsBool(property, "gen-property", true)> <#if pojo.hasMetaAttribute(property, "field-description")>/**${pojo.getFieldJavaDoc(property, 0)}*/ </#if> <#foreach column in property.columnIterator> <#if column.comment?exists && column.comment?trim?length!=0> /** ${column.comment} */</#if></#foreach><#include "GetPropertyAnnotation.ftl"/> ${pojo.getFieldModifiers(property)} ${pojo.getJavaTypeName(property, jdk5)} ${property.name}<#if pojo.hasFieldInitializor(property, jdk5)> = ${pojo.getFieldInitialization(property, jdk5)}</#if>;</#if></#foreach>