views:

212

answers:

2

In the Ant task of the Hibernate Tool hbmtemplate, it is possible to use *.hbm.xml files as input instead of reading table descriptions over JDBC.

Is there a way to do the same in the hbmtemplate goal of the Hibernate3 Maven plugin from codehaus?

In Ant, I can do this by adding a fileset to the configuration:

<configuration configurationfile="hibernate.cfg.xml">
  <fileset dir="generated/xml">
    <include name="*.hbm.xml"/>
  </fileset>
</configuration>

<hbmtemplate templateprefix="pojo/" template="Pojo.ftl" />

A: 

Can you put the hbm.xml files in your src/main/resources or src/test/resources directory? Maven adds those folders to the classpath.

John Paulett
I tried it without success. The plugin always needs a JDBC connection and I can not override this behaviour. For now, I will follow a different path but maybe the plugin will see an update, if I submit a feature request :)
mjustin
A: 

Well, it is always possible to use Ant in maven, using the antrun plugin. This way, you can set a task in the generate-sources phase.

EJB
This is so easy, it would feel like cheating ;) ...
mjustin