hibernate-maven-plugin 2.0.0 released!

Today we released the version 2.0.0 of hibernate-maven-plugin to Central!

Why Now?

During one of our other projects ‐ the development of a vertical search-engine for events and locations, which is funded by the mistery of economy of NRW ‐, we realized, that we were in the need of Hibernate 5 and some of the more sophisticated JPA-configuration-options.

Unfortunatly ‐ for us ‐ the old releases of this plugin neither support Hibernate 5 nor all configuration options, that are available for use in the META-INF/persistence.xml.

Fortunatly ‐ for you ‐ we decided, that we really need all that and have to integrate it in our little plugin.

Nearly Complete Rewrite

Due to changes in the way Hibernate has to be configured internally, this release is a nearly complete rewrite. It was no longer possible, to just use the SchemaExport-Tool to build up the configuration and support all possible configuration-approaches. Hence, the plugin now builds up the configuration using Services and Registries, like described in the Integration Guide.

Simplified Configuration: No Drop-In-Replacement!

We also took the opportunity, to simplify the configuration. Beforehand, the plugin had just used the configuration, that was set up in the class SchemaExport. This reliefed us from the burden, to understand the configuration internals, but brought up some oddities of the internal implementation of the tool. It also turned out to be a bad decision in the long run, because some configuration options are hard coded in that class and cannot be changed.

By building up the whole configuration by hand, it is now possible to implement separate goals for creating and dropping the schema. Also, it enables us to add a goal update in one of the next releases. Because of all this improvements, you have to revise your configuration, if you want to switch from 1.x to 2.x.

Be warned: this release is no drop-in replacement of the previous releases!

Not Only For 4, But For Any Version

While rewirting the plugin, we focused on Hibernate 5, which was not supported by the older releases, because of some of the oddities of the internal implementation of the SchemaExport-tool. We tried to maintain backward compatibility.

You should be able to use the new plugin with Hibernate 5 and also with older versions of Hibernate (we only tested that for Hibernate 4). Because of that, we dropped the 4 in the name of the plugin!

Extended Support For JPA-Configurations

We tried to support all possible configuration-approaches, that Hibernate 5 understands. Including hard coded XML-mapping-files in the META-INF/persistence.xml, that do not seem to be used very often, but which we needed in one of our own projects.

Therefore, the plugin now understands all (or most of?) the relevant configuration options, that one can specify through a standard JPA-configuration. The plugin now should work with any configuration, that you drop in from your existing JPA- or Hibernate-projects. All recognized configuration from the different possible configuration-sources are merged together, considering the configuration-method-precedence, described in the documentation.

We hope, we did not make any unhandy assumptions, while designing the merge-process. Please let us know, if something wents wrong in your projects and you think it is, because we messed it up!

Release notes:

commit 64b7446c958efc15daf520c1ca929c6b8d3b8af5
Author: Kai Moritz 
Date:   Tue Mar 8 00:25:50 2016 +0100

    javadoc hat to be configured multiple times for release:prepare

commit 1730d92a6da63bdcc81f7a1c9020e73cdc0adc13
Author: Kai Moritz 
Date:   Tue Mar 8 00:13:10 2016 +0100

    Added the special javadoc-tags for maven-plugins to the configuration

commit 0611db682bc69b80d8567bf9316668a1b6161725
Author: Kai Moritz 
Date:   Mon Mar 7 16:01:59 2016 +0100

    Updated documentation

commit a275df25c52fdb7b5b4275fcf9a359194f7b9116
Author: Kai Moritz 
Date:   Mon Mar 7 17:56:16 2016 +0100

    Fixed missing menu on generated site: moved template from skin to project

commit e8263ad80b1651b812618c964fb02f7e5ddf3d7e
Author: Kai Moritz 
Date:   Mon Mar 7 14:44:53 2016 +0100

    Turned of doclint, that was introduced in Java 8
    
    See: http://blog.joda.org/2014/02/turning-off-doclint-in-jdk-8-javadoc.html

commit 62ec2b1b98d5ce144f1ac41815b94293a52e91e6
Author: Kai Moritz 
Date:   Tue Dec 22 19:56:41 2015 +0100

    Fixed ConcurrentModificationException

commit 9d6e06c972ddda45bf0cd2e6a5e11d8fa319c290
Author: Kai Moritz 
Date:   Mon Dec 21 17:01:42 2015 +0100

    Fixed bug regarding the skipping of unmodified builds
    
    If a property or class was removed, its value or md5sum stayed in the set
    of md5sums, so that each following build (without a clean) was juged as
    modified.

commit dc652540d007799fb23fc11d06186aa5325058db
Author: Kai Moritz 
Date:   Sun Dec 20 21:06:37 2015 +0100

    All packages up to the root are checked for annotations

commit 851ced4e14fefba16b690155b698e7a39670e196
Author: Kai Moritz 
Date:   Sun Dec 20 13:32:48 2015 +0100

    Fixed bug: the execution is no more skipped after a failed build
    
    After a failed build, further executions of the plugin were skipped, because
    the MD5-summs suggested, that nothing is to do because nothing has changed.
    Because of that, the MD5-summs are now removed in case of a failure.

commit 08649780d2cd70f2861298d683aa6b1945d43cda
Author: Kai Moritz 
Date:   Sat Dec 19 18:02:02 2015 +0100

    Mappings from JPA-mapping-files are considered

commit bb8b638714db7fc02acdc1a9032cc43210fe5c0e
Author: Kai Moritz 
Date:   Sat Dec 19 03:46:49 2015 +0100

    Fixed minor misconfiguration in integration-test dependency test
    
    Error because of multiple persistence-units by repeated execution

commit 3a7590b8862c3be691b05110f423865f6674f6f6
Author: Kai Moritz 
Date:   Thu Dec 17 03:10:33 2015 +0100

    Considering mapping-configuration from persistence.xml and hibernate.cfg.xml

commit 23668ccaa93bfbc583c1697214bae116bd9f4ef6
Author: Kai Moritz 
Date:   Thu Dec 17 02:53:38 2015 +0100

    Sidestepped bug in Hibernate 5

commit 8e5921c9e76b4540f1d4b75e05e338001145ff6d
Author: Kai Moritz 
Date:   Wed Dec 16 22:09:00 2015 +0100

    Introduced the goal "drop"
    
     * Fixed integration-test hibernate4-maven-plugin-envers-sample by adapting
       it to the new drop-goal
     * Adapted the other integration-tests to the new naming schema for the
       create-script

commit 6dff3bfb0f9ea7a1d0cc56398aaad29e31a17b91
Author: Kai Moritz 
Date:   Wed Dec 16 18:08:56 2015 +0100

    Reworked configuration and the tracking thereof
    
     * Moved common parameters from CreateMojo to AbstractSchemaMojo
     * Reordered parameters into sensible groups
     * Renamed the maven-property-names of the parameters
     * All configuration-parameters are tracked, not only hibernate-parameters
     * Introduced special treatment for some of the plugin-parameters (export
       and show)

commit b316a5b4122c3490047b68e1e4a6df205645aad5
Author: Kai Moritz 
Date:   Wed Oct 21 11:49:56 2015 +0200

    Reworked plugin-configuration: worshipped the DRY-principle

commit 4940080670944a15916c68fb294e18a6bfef12d5
Author: Kai Moritz 
Date:   Fri Oct 16 12:16:30 2015 +0200

    Refined reimplementation of the plugin for Hibernate 5.x
    
    Renamed the plugin from hibernate4-maven-plugin to hibernate-maven-plugin,
    because the goal is, to support all recent older versions with the new
    plugin.

commit fdda82a6f76deefd10f83da89d7e82054e3c3ecd
Author: Kai Moritz 
Date:   Wed Oct 21 12:18:29 2015 +0200

    Integration-Tests are skiped, if "maven.test.skip" is set to true

commit b971570e28cbdc3b27eca15a7395586bee787446
Author: Kai Moritz 
Date:   Tue Sep 8 13:55:43 2015 +0200

    Updated version of juplo-skin for generation of documentation

commit 3541cf3742dd066b94365d351a3ca39a35e3d3c8
Author: Kai Moritz 
Date:   Tue May 19 21:41:50 2015 +0200

    Added new configuration sources in documentation about precedence


Funded by the Europian Union

This article was published in the course of a resarch-project, that is funded by the European Union and the federal state Northrhine-Wetphalia.

Europäische Union: Investitionen in unsere Zukunft - Europäischer Fonds für regionale Entwicklung EFRE.NRW 2014-2020: Invesitionen in Wachstum und Beschäftigung

Comments / Questions

  1. Simon says:

    Hey thanks for the update to hibernate 5.
    We are just migrating from your older version and we have a question:
    Is there a way to add support for @NotNull annotations (javax.validation.constraints)?

    In the previous version (for hibernate 4) the plugin could handle those @NotNull annotated fields and generated a Not Null constraint.
    But now with the current version all fields which only had @NotNull will rest nullable in the generated script until you add @Column(nullable = false).

Leave a Reply

Your email address will not be published. Required fields are marked *