2

I would like to use the Hibernate3 plugin for Maven (developed by Codehaus) but according to the last release date (2009-01-21), it seems that it's not actively supported. I need to use the hbm2ddl tool provided by Hibernate. What do you think?

Where the hbm2ddl tool is provided? I guess this is not the Hibernate3 Maven plugin that includes it, but it is included in the hibernate dependencies?

Thanks

manash
  • 6,985
  • 12
  • 65
  • 125

2 Answers2

1

Probably you've found the old plugin's site that ends with 2.2 version. Check this site out: http://mojo.codehaus.org/hibernate3-maven-plugin/

As you can see, there's 3.0 version released 2 months ago. We use it in our project with Hibernate 3.5 and it works pretty well, doing what it is supposed to do.

Hibernate doesn't need to be provided to the plugin (at least directly), because under the cover this stuff uses Hibernate3 Ant Tasks (from hibernate-tools artifact) with Maven AntRun Plugin. So the plugin has a dependency on Hibernate (3.3.2.GA version) itself. As I said however, we use it with Hibernate 3.5 without any problem so far.

Michał Kalinowski
  • 16,925
  • 5
  • 35
  • 48
  • Thanks, indeed I was in the old site. So, the Ant task uses Hibernate 3.3.2.GA? I guess that from version 3.3.2.GA, some mapping changes have been done. Thus, they are not taken into account when generating the schema with hbm2ddl? – manash Apr 04 '12 at 13:22
  • Unfortunately, I can't help you this time. I don't know if mappings actually changed. I didn't even try to force use of newer Hibernate version. For us it works, so we don't touch it anymore :P. – Michał Kalinowski Apr 04 '12 at 20:37
0

If you want to use hbm2ddl for current hibernate (5.+) with better quality generated schema, then please take a look at project:

https://github.com/Devskiller/hbm2ddl-maven-plugin

Simple use case

<build>
    <plugins>
        <plugin>
            <groupId>com.devskiller.hbm2ddl-maven-plugin</groupId>
            <artifactId>hbm2ddl-maven-plugin</artifactId>
            <version>0.9.2</version>
            <extensions>true</extensions> <!-- required to run automatically -->
            <configuration>
                <packages>
                    <package>com.test.model</package>
                </packages>
            </configuration>
        </plugin>
    </plugins>
</build>
MariuszS
  • 30,646
  • 12
  • 114
  • 155