除了生成其他源文件之外,我还想为 DAO 类生成一个工厂类 - DAOFactory.java。我为此目的使用 hbmtemplate - 使用我自己的 *.ftl 文件。问题是(我理解正确)为数据库中的每个实体生成文件。是否可以只生成一次该文件?
我的 pom.xml 的一部分:
<execution>
<id>hbmtemplate0</id>
<phase>generate-sources</phase>
<goals>
<goal>hbmtemplate</goal>
</goals>
<configuration>
<components>
<component>
<name>hbmtemplate</name>
<outputDirectory>src/main/java</outputDirectory>
</component>
</components>
<componentProperties>
<revengfile>/src/main/resources/hibernate.reveng.xml</revengfile>
<propertyfile>src/main/resources/database.properties</propertyfile>
<jdk5>false</jdk5>
<ejb3>false</ejb3>
<packagename>my.package.name</packagename>
<format>true</format>
<haltonerror>true</haltonerror>
<templatepath>src/main/resources/reveng.templates/</templatepath>
<filepattern>DAOFactory.java</filepattern>
<template>DAOFactory.java.ftl</template>
</componentProperties>
</configuration>
</execution>