max wrote:
yes, but *how*, e.g. how do your <hibernatetool> "call" looks like.
Ok, hope this helps. :-)
My Ant xml look like this:
Code:
<target name="hibernatetool.properties" depends="">
<property name="hibernatetool.destdir" value="${basedir}/demo" />
<property name="hibernatetool.template.path" value="${basedir}/freemarker" />
<property name="hibernatetool.configuration" value="${basedir}/hibernate.cfg.xml" />
<property name="hibernatetool.reveng.strategy" value="package.to.my.CustomReverseEngineeringStrategy" />
<property name="hibernatetool.reveng.package" value="package.to.my.persistence.classes" />
<property name="hibernatetool.reveng.revengfile" value="${basedir}/hibernate.reveng.xml" />
<property name="hibernatetool.use.jdk5" value="true" />
<property name="hibernatetool.use.ejb3" value="true" />
</target>
<target name="hibernatetool" depends="task.define,hibernatetool.properties">
<hibernatetool
destdir="${hibernatetool.destdir}"
templatepath="${hibernatetool.template.path}/pojo">
<classpath>
<pathelement path="${developer.working.directory.classes}" />
<path refid="lib.external.class.path" />
<path refid="ant.class.path" />
</classpath>
<jdbcconfiguration
configurationfile="${hibernatetool.configuration}"
reversestrategy="${hibernatetool.reveng.strategy}"
packagename="${hibernatetool.reveng.package}.base"
revengfile="${hibernatetool.reveng.revengfile}"
/>
<hbmtemplate
exporterclass="package.to.my.CustomExporter"
>
<property key="filepattern" value="{package-name}/{class-name}.java" />
<property key="template" value="Pojo.ftl" />
<property key="jdk5" value="${hibernatetool.use.jdk5}" />
<property key="ejb3" value="${hibernatetool.use.ejb3}" />
</hbmtemplate>
</hibernatetool>
</target>
If I set fiepattern as an attribute for hbmtemplate like this
Code:
<hbmtemplate
exporterclass="package.to.my.CustomExporter"
filepattern="{package-name}/{class-name}.java"
>
...
I receive an exception
Code:
org.hibernate.tool.hbm2x.ExporterException: File pattern not set on GenericExporter
. If I set it as a property this exception does not occur. Simmilar for template.
In my custom exporter I override doStart() and call
Code:
super.setFilePattern(super.getProperties().getProperty("filepattern"));
super.setTemplateName(super.getProperties().getProperty("template"));
super.doStart();