Hi,
I am using a slightly adapted FTL-template (Pojo.ftl) to generate DTOs. So on first attempt I tried to name all the files "xyDTO.java"; the same with the class-names. This works fine:
Code:
<!-- Generate DTOs -->
<hbmtemplate
filepattern="../../shared/dto/{class-name}DTO.java"
templatepath="${templatepath}/dto"
template="DTO.ftl">
<property key="jdk5" value="true" />
<property key="ejb3" value="false" />
<property key="package" value="org.mycompany.mysoftware.shared.dto" />
</hbmtemplate>
But when it comes to the field declarations, the entity names instead of xyDTO are inserted for this part of the template:
Code:
// Fields
<#foreach field in pojo.getAllPropertiesIterator()><#if pojo.getMetaAttribAsBool(field, "gen-property", true)> <#if pojo.hasMetaAttribute(field, "field-description")> /**
${pojo.getFieldJavaDoc(field, 0)}
*/
</#if> ${pojo.getFieldModifiers(field)} ${pojo.getJavaTypeName(field, jdk5)} ${field.name}<#if pojo.hasFieldInitializor(field, jdk5)> = ${pojo.getFieldInitialization(field, jdk5)}</#if>;
</#if>
</#foreach>
Simply putting a DTO at the end of the JavaTypeName transforms primitive dataypes too: intDTO. This is NOT what I want to achieve.
I just want to have the fields and property accessors of my entities named like "MyReferencedEntityDTO" instead of "MyReferencedEntity".
How is this possible please?