Discussion:
hibernate3-maven-plugin hbm2java DIY PojoConstructors.ftl, how?
Andrew Hughes
2012-01-10 01:14:49 UTC
Permalink
Hi All,

Can someone please help me join the dots? Due to what I call is (arguably)
a bug in hibernate-tools it's generating an illegal constructor (255+
arg's). A suitable workaround is to customize the codegen (see
http://stackoverflow.com/questions/7365546/generated-full-constructor-contains-too-many-params
).

Question: If I can use pojo/PojoConstructors.ftl to customize codegen (as
the link above suggests), how can I configure the
hibernate3-maven-plugin / hbm2java
to use it? I can only find ant and hibernate tools doco, which is sadly
little help.

Thanks in Advance,
AH
Mark Prins
2012-01-11 13:02:11 UTC
Permalink
Post by Andrew Hughes
Hi All,
Can someone please help me join the dots? Due to what I call is
(arguably) a bug in hibernate-tools it's generating an illegal
constructor (255+ arg's). A suitable workaround is to customize the
codegen (see
http://stackoverflow.com/questions/7365546/generated-full-constructor-contains-too-many-params ).
Question: If I can use pojo/PojoConstructors.ftl to customize codegen
(as the link above suggests), how can I configure the
hibernate3-maven-plugin / hbm2java to use it? I can only find ant
and hibernate tools doco, which is sadly little help.
i once had this working using:

<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>hibernate3-maven-plugin</artifactId>
<version>2.2</version>
<executions>
<execution>
<id>create-hibernate-config</id>
<phase>generate-resources</phase>
<goals>
<goal>hbm2cfgxml</goal>
</goals>
</execution>
<execution>
<id>create-hibernate-pojo</id>
<phase>generate-sources</phase>
<goals>
<goal>hbm2java</goal>
</goals>
</execution>
<execution>
<id>process-hibernate-classes</id>
<phase>process-sources</phase>
<goals>
<goal>hbmtemplate</goal>
</goals>
</execution>
</executions>
<configuration>
<lineLength>76</lineLength>
<indentSize>4</indentSize>
<components>
<component>
<name>hbm2cfgxml</name>
<implementation>jdbcconfiguration</implementation>
</component>
<component>
<name>hbm2java</name>
<implementation>jdbcconfiguration</implementation>
</component>
</components>
<componentProperties>

<revengfile>src/main/resources/hibernate.reveng.xml</revengfile>
<jdk5>true</jdk5>
<ejb3>true</ejb3>

<propertyfile>src/main/resources/database.properties</propertyfile>
<packagename>nl.pdok.gazetteer.model.base</packagename>
<filepattern>{package-name}/{class-name}.java</filepattern>
<template>blanco-template.ftl</template>
<templatepath>src/main/templates</templatepath>
</componentProperties>
</configuration>

All the .ftl go in src/main/templates/pojo where you can edit/override them.
YMMV, Mark

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

Loading...