hibernate4-maven-plugin 1.1.0 released!

Today we released the version 1.1.0 of hibernate4-maven-plugin to Central!

The main work in this release were modification to the process of configuration-gathering.
The plugin now also is looking for a hibernate.cfg.xml on the classpath or a persistence-unit specified in a META-INF/persistence.xml.

With this enhancement, the plugin is now able to deal with all examples from the official
Hibernate Getting Started Guide.

All configuration infos found are merged together with the same default precedences applied by hibernate.
So, the overall order, in which possible configuration-sources are checked is now (each later source might overwrite settings of a previous source):

  1. hibernate.properties
  2. hibernate.cfg.xml
  3. persistence.xml
  4. maven properties
  5. plugin configuration

Because the possible new configuration-sources might change the expected behavior of the plugin, we lifted the version to 1.1.

This release also fixes a bug, that occured on some platforms, if the path to the project includes one or more space characters.

Release notes:


commit 94e6b2e93fe107e75c9d20aa1eb3126e78a5ed0a
Author: Kai Moritz
Date: Sat May 16 14:14:44 2015 +0200

Added script to check outcome of the hibernate-tutorials

commit b3f8db2fdd9eddbaac002f94068dd1b4e6aef9a8
Author: Kai Moritz
Date: Tue May 5 12:43:15 2015 +0200

Configured hibernate-tutorials to use the plugin

commit 4b6fc12d443b0594310e5922e6ad763891d5d8fe
Author: Kai Moritz
Date: Tue May 5 12:21:39 2015 +0200

Fixed the settings in the pom's of the tutorials

commit 70bd20689badc18bed866b3847565e1278433503
Author: Kai Moritz
Date: Tue May 5 11:49:30 2015 +0200

Added tutorials of the hibernate-release 4.3.9.Final as integration-tests

commit 7e3e9b90d61b077e48b59fc0eb63059886c68cf5
Author: Kai Moritz
Date: Sat May 16 11:04:36 2015 +0200

JPA-jdbc-properties are used, if appropriate hibernate-properties are missing

commit c573877a186bec734915fdb3658db312e66a9083
Author: Kai Moritz
Date: Thu May 14 23:43:13 2015 +0200

Hibernate configuration is gathered from class-path by default

commit 2a85cb05542795f9cd2eed448f212f92842a85e8
Author: Kai Moritz
Date: Wed May 13 09:44:18 2015 +0200

Found no way to check, that mapped classes were found

commit 038ccf9c60be6c77e2ba9c2d2a2a0d261ce02ccb
Author: Kai Moritz
Date: Tue May 12 22:13:23 2015 +0200

Upgraded scannotation from 1.0.3 to 1.0.4

This fixes the bug that occures on some platforms, if the path contains a
space. Created a fork of scannotation to bring the latest bug-fixes from SVN
to maven central...

commit c43094689043d7da04df6ca55529d0f0c089d820
Author: Kai Moritz
Date: Sun May 10 19:06:27 2015 +0200

Added javadoc-jar to deployed artifact

commit 524cb8c971de87c21d0d9f0e04edf6bd30f77acc
Author: Kai Moritz
Date: Sat May 9 23:48:39 2015 +0200

Be sure to relase all resources (closing db-connections!)

commit 1e5cca792c49d60e20d7355eb97b13d591d80af6
Author: Kai Moritz
Date: Sat May 9 22:07:31 2015 +0200

Settings in a hibernate.cfg.xml are read

commit 9156c5f6414b676d34eb0c934e70604ba822d09a
Author: Kai Moritz
Date: Tue May 5 23:42:40 2015 +0200

Catched NPE, if hibernate-dialect is not set

commit 62859b260a47e70870e795304756bba2750392e3
Author: Kai Moritz
Date: Sun May 3 18:53:24 2015 +0200

Upgraded oss-type, maven-plugin-api and build/report-plugins

commit c1b3b60be4ad2c5c78cb1e3706019dfceb390f89
Author: Kai Moritz
Date: Sun May 3 18:53:04 2015 +0200

Upgraded hibernate to 4.3.9.Final

commit 038ccf9c60be6c77e2ba9c2d2a2a0d261ce02ccb
Author: Kai Moritz
Date: Tue May 12 22:13:23 2015 +0200

Upgraded scannotation from 1.0.3 to 1.0.4

This fixes the bug that occures on some platforms, if the path contains a
space. Created a fork of scannotation to bring the latest bug-fixes from SVN
to maven central...

commit c43094689043d7da04df6ca55529d0f0c089d820
Author: Kai Moritz
Date: Sun May 10 19:06:27 2015 +0200

Added javadoc-jar to deployed artifact

commit 524cb8c971de87c21d0d9f0e04edf6bd30f77acc
Author: Kai Moritz
Date: Sat May 9 23:48:39 2015 +0200

Be sure to relase all resources (closing db-connections!)

commit 1e5cca792c49d60e20d7355eb97b13d591d80af6
Author: Kai Moritz
Date: Sat May 9 22:07:31 2015 +0200

Settings in a hibernate.cfg.xml are read

commit 9156c5f6414b676d34eb0c934e70604ba822d09a
Author: Kai Moritz
Date: Tue May 5 23:42:40 2015 +0200

Catched NPE, if hibernate-dialect is not set

commit 62859b260a47e70870e795304756bba2750392e3
Author: Kai Moritz
Date: Sun May 3 18:53:24 2015 +0200

Upgraded oss-type, maven-plugin-api and build/report-plugins

commit c1b3b60be4ad2c5c78cb1e3706019dfceb390f89
Author: Kai Moritz
Date: Sun May 3 18:53:04 2015 +0200

Upgraded hibernate to 4.3.9.Final

commit 038ccf9c60be6c77e2ba9c2d2a2a0d261ce02ccb
Author: Kai Moritz
Date: Tue May 12 22:13:23 2015 +0200

Upgraded scannotation from 1.0.3 to 1.0.4

This fixes the bug that occures on some platforms, if the path contains a
space. Created a fork of scannotation to bring the latest bug-fixes from SVN
to maven central...

commit c43094689043d7da04df6ca55529d0f0c089d820
Author: Kai Moritz
Date: Sun May 10 19:06:27 2015 +0200

Added javadoc-jar to deployed artifact

commit 524cb8c971de87c21d0d9f0e04edf6bd30f77acc
Author: Kai Moritz
Date: Sat May 9 23:48:39 2015 +0200

Be sure to relase all resources (closing db-connections!)

commit 1e5cca792c49d60e20d7355eb97b13d591d80af6
Author: Kai Moritz
Date: Sat May 9 22:07:31 2015 +0200

Settings in a hibernate.cfg.xml are read

commit 9156c5f6414b676d34eb0c934e70604ba822d09a
Author: Kai Moritz
Date: Tue May 5 23:42:40 2015 +0200

Catched NPE, if hibernate-dialect is not set

commit 62859b260a47e70870e795304756bba2750392e3
Author: Kai Moritz
Date: Sun May 3 18:53:24 2015 +0200

Upgraded oss-type, maven-plugin-api and build/report-plugins

commit c1b3b60be4ad2c5c78cb1e3706019dfceb390f89
Author: Kai Moritz
Date: Sun May 3 18:53:04 2015 +0200

Upgraded hibernate to 4.3.9.Final

commit 248ff3220acc8a2c11281959a1496adc024dd4df
Author: Kai Moritz
Date: Sun May 3 18:09:12 2015 +0200

Renamed nex release to 1.1.0

commit 2031d4cfdb8b2d16e4f2c7bbb5c03a15b4f64b21
Author: Kai Moritz
Date: Sun May 3 16:48:43 2015 +0200

Generation of tables and rows for auditing is now default

commit 42465d2a5e4a5adc44fbaf79104ce8cc25ecd8fd
Author: Kai Moritz
Date: Sun May 3 16:20:58 2015 +0200

Fixed mojo to scan for properties in persistence.xml

commit d5a4326bf1fe2045a7b2183cfd3d8fdb30fcb406
Author: Kai Moritz
Date: Sun May 3 14:51:12 2015 +0200

Added an integration-test, that depends on properties from a persistence.xml

commit 5da1114d419ae10f94a83ad56cea9856a39f00b6
Author: Kai Moritz
Date: Sun May 3 14:51:46 2015 +0200

Switched to usage of a ServiceRegistry

commit fed9fc9e4e053c8b61895e78d1fbe045fadf7348
Author: Kai Moritz
Date: Sun May 3 11:42:54 2015 +0200

Integration-Test for envers really generates the SQL

commit fee05864d61145a06ee870fbffd3bff1e95af08c
Author: Kai Moritz
Date: Sun Mar 15 16:56:22 2015 +0100

Extended integration-test "hib-test" to check for package-level annotations

commit 7518f2a7e8a3d900c194dbe61609efa34ef047bd
Author: Kai Moritz
Date: Sun Mar 15 15:42:01 2015 +0100

Added support for m2e

Thanks to Andreas Khutz

hibernate4-maven-plugin 1.0.5 released!

Today we released the version 1.0.5 of hibernate4-maven-plugin to Central!

This release mainly fixes a NullPointerException-bug, that was introduced in 1.0.4.
The NPE was triggered, if a hibernate.properties-file is present and the dialect is specified in that file and not in the plugin configuration.
Thanks to Paulo Pires and and everflux, for pointing me at that bug.

But there are also some minor improvements to talk about:

  • Package level annotations are now supported (Thanks to Joachim Van der Auwera for that)
  • Hibernate Core was upgraded to 4.3.7.Final
  • Hibernate Envers was upgraded to 4.3.7.Final
  • Hibernate Validator was upgrades to 5.1.3.Final

The upgrade of Hibernate Validator is a big step, because 5.x supports Bean Validation 1.1 (JSR 349).
See the FAQ of hibernate-validator for more details on this.

Because Hibernate Validator 5 requires the Unified Expression Language (EL) in version 2.2 or later, a dependency to javax.el-api:3.0.0 was added.
That does the trick for the integration-tests included in the source code of the plugin.
But, because I am not using Hibernate Validator in any of my own projects, at the moment, the upgrade may rise some backward compatibility errors, that I am not aware of.
If you stumble across any problems, please let me know!

Release notes:


commit ec30af2068f2d12a9acf65474ca1a4cdc1aa7122
Author: Kai Moritz
Date: Tue Nov 11 15:28:12 2014 +0100

[maven-release-plugin] prepare for next development iteration

commit 18840e3c775584744199d8323eb681b73b98e9c4
Author: Kai Moritz
Date: Tue Nov 11 15:27:57 2014 +0100

[maven-release-plugin] prepare release hibernate4-maven-plugin-1.0.5

commit b95416ef16bbaafecb3d40888fe97e70cdd75c77
Author: Kai Moritz
Date: Tue Nov 11 15:10:32 2014 +0100

Upgraded hibernate-validator from 4.3.2.Final to 5.1.3.Final

Hibernate Validator 5 requires the Unified Expression Language (EL) in
version 2.2 or later. Therefore, a dependency to javax.el-api:3.0.0 was
added. (Without that, the compilation of some integration-tests fails!)

commit ad979a8a82a7701a891a59a183ea4be66672145b
Author: Kai Moritz
Date: Tue Nov 11 14:32:42 2014 +0100

Upgraded hibernate-core, hibernate-envers, hibernate-validator and maven-core

* Upgraded hibernate-core from 4.3.1.Final to 4.3.7.Final
* Upgraded hibernate-envers from 4.3.1.Final to 4.3.7.Final
* Upgraded hibernate-validator from 4.3.1.Final to 4.3.2.Final
* Upgraded maven-core from 3.2.1 to 3.2.3

commit 347236c3cea0f204cefd860c605d9f086e674e8b
Author: Kai Moritz
Date: Tue Nov 11 14:29:23 2014 +0100

Added FAQ-entry for problem with whitespaces in the path under Windows

commit 473c3ef285c19e0f0b85643b67bbd77e06c0b926
Author: Kai Moritz
Date: Tue Oct 28 23:37:45 2014 +0100

Explained how to suppress dependency-scanning in documentation

Also added a test-case to be sure, that dependency-scanning is skipped, if
the parameter "dependencyScanning" is set to "none".

commit 74c0dd783b84c90e116f3e7f1c8d6109845ba71f
Author: Kai Moritz
Date: Mon Oct 27 09:04:48 2014 +0100

Fixed NullPointerException, when dialect is specified in properties-file

Also added an integration test-case, that proofed, that the error was
solved.

commit d27f7af23c82167e873ce143e50ce9d9a65f5e61
Author: Kai Moritz
Date: Sun Oct 26 11:16:00 2014 +0100

Renamed an integration-test to test for whitespaces in the filename

commit 426d18e689b89f33bf71601becfa465a00067b10
Author: Kai Moritz
Date: Sat Oct 25 17:29:41 2014 +0200

Added patch by Joachim Van der Auwera to support package level annotations

commit 3a3aeaabdb1841faf5e1bf8d220230597fb22931
Author: Kai Moritz
Date: Sat Oct 25 16:52:34 2014 +0200

Integrated integration test provided by Claus Graf (clausgraf@gmail.com)

commit 3dd832edbd50b1499ea6d53e4bcd0ad4c79640ed
Author: Kai Moritz
Date: Mon Jun 2 10:31:13 2014 +0200

[maven-release-plugin] prepare for next development iteration

hibernate4-maven-plugin 1.0.4 released!

We finally did it.
Today we released the version 1.0.4 of hibernate4-maven-plugin to Central!

This release mainly is a library-upgrade to version 4.3.1.Final of hibernate.
It also includes some bug-fixes provided by the community.
Please see the release notes for details.

It took us quiet some time, to release this version and we are sorry for that.
But with a growing number of users, we are becoming more anxious to break some special use-cases.
Because of that, we started to add some integration-tests, to avoid that hassle, and that took us some time…

If you have some special small-sized (example) use-cases for the plugin, we would appreciate it, if you would provide them to us, so we can add them es additional integration-tests.

Release notes:


commit f3dabc0e6e3676244986b5bbffdb67d427c8383c
Author: Kai Moritz
Date: Mon Jun 2 10:31:12 2014 +0200

[maven-release-plugin] prepare release hibernate4-maven-plugin-1.0.4

commit 856dd31c9b90708e841163c91261a865f9efd224
Author: Kai Moritz
Date: Mon Jun 2 10:12:24 2014 +0200

Updated documentation

commit 64900890db2575b7a28790c5e4d5f45083ee94b3
Author: Kai Moritz
Date: Tue Apr 29 20:43:15 2014 +0200

Switched documentation to xhtml, to be able to integrate google-pretty-print

commit bd78c276663790bf7a3f121db85a0d62c64ce38c
Author: Kai Moritz
Date: Tue Apr 29 19:42:41 2014 +0200

Fixed bug in site-configuration

commit 1628bcf6c9290a729352215ee22e5b48fa628c4c
Author: Kai Moritz
Date: Tue Apr 29 18:07:44 2014 +0200

Verifying generated SQL in integration-test hibernate4-maven-plugin-envers-sample

commit 25079f13c0eda6807d5aee67086a21ddde313213
Author: Kai Moritz
Date: Tue Apr 29 18:01:10 2014 +0200

Added integration-test provided by Erik-Berndt Scheper

commit 69458703cddc2aea1f67e06db43bce6950c6f3cb
Author: Kai Moritz
Date: Tue Apr 29 17:52:17 2014 +0200

Verifying generated SQL in integration-test schemaexport-example

commit a53a2ad438038084200a8449c557a41159e409dc
Author: Kai Moritz
Date: Tue Apr 29 17:46:05 2014 +0200

Added integration-test provided by Guido Wimmel

commit f18f820198878cddcea8b98c2a5e0c9843b923d2
Author: Kai Moritz
Date: Tue Apr 29 09:43:06 2014 +0200

Verifying generated SQL in integration-test hib-test

commit 4bb462610138332087d808a62c84a0c9776b24cc
Author: Kai Moritz
Date: Tue Apr 29 08:58:33 2014 +0200

Added integration-test provided by Joel Johnson

commit c5c4c7a4007bc2bd58b850150adb78f8518788da
Author: Kai Moritz
Date: Tue Apr 29 08:43:28 2014 +0200

Prepared POM for integration-tests via invoker-maven-plugin

commit d8647fedfe936f49476a5c1f095d51a9f5703d3d
Author: Kai Moritz
Date: Tue Apr 29 08:41:50 2014 +0200

Upgraded Version of maven from 3.0.4 to 3.2.1

commit 1979c6349fc2a9e0fe3f028fa1cc76557b32031c
Author: Frank Schimmel
Date: Wed Feb 12 15:16:18 2014 +0100

Properly support constraints expressed by bean validation (jsr303) annotations.

* Access public method of package-visible TypeSafeActivator class without reflection.
* Fix arguments to call of TypeSafeActivator.applyRelationalConstraints().
* Use hibernate version 4.3.1.Final for all components.
* Minor refactorings in exception handling.

commit c3a16dc3704517d53501914bb8a0f95f856585f4
Author: Kai Moritz
Date: Fri Jan 17 09:05:05 2014 +0100

Added last contributors to the POM

commit 5fba40e135677130cbe0ff3c59f6055228293d92
Author: Mark Robinson
Date: Fri Jan 17 08:53:47 2014 +0100

Generated schema now corresponds to hibernate validators set on the beans

commit aedcc19cfb89a8b387399a978afab1166be816e3
Author: Kai Moritz
Date: Thu Jan 16 18:33:32 2014 +0100

Upgrade to Hibernate 4.3.0.Final

commit 734356ab74d2896ec8d7530af0d2fa60ff58001f
Author: Kai Moritz
Date: Thu Jan 16 18:23:12 2014 +0100

Improved documentation of the dependency-scanning on the pitfalls-page

commit f2955fc974239cbb266922c04e8e11101d7e9dd9
Author: Joel Johnson
Date: Thu Dec 26 14:33:51 2013 -0700

Text cleanup, spelling, etc.

commit 727d1a35bb213589270b097d04d5a1f480bffef6
Author: Joel Johnson
Date: Thu Dec 26 14:02:29 2013 -0700

Make output file handling more robust

* Ensure output file directory path exists
* Anchor relative paths in build directory

commit eeb182205a51c4507e61e1862af184341e65dbd3
Author: Joel Johnson
Date: Thu Dec 26 13:53:37 2013 -0700

Check that md5 path is file and has content

commit 64c0a52bdd82142a4c8caef18ab0671a74fdc6c1
Author: Joel Johnson
Date: Thu Dec 26 11:25:34 2013 -0700

Use more descriptive filename for schema md5

commit ba2e48a347a839be63cbce4b7ca2469a600748c6
Author: Joel Johnson
Date: Thu Dec 26 11:20:24 2013 -0700

Offer explicit disable option

Use an explicit disable property, but still default it to test state

commit e44434257040745e66e0596b262dd0227b085729
Author: Kai Moritz
Date: Fri Oct 18 01:55:11 2013 +0200

[maven-release-plugin] prepare for next development iteration

hibernate4-maven-plugin 1.0.3 released!

Today we released the version 1.0.3 of hibernate4-maven-plugin to Central.

Scanning dependencies

This release of the plugin now supports scanning of dependencies. By default all dependencies in the scope compile are scanned for annotated classes. Thanks to Guido Wimmel, who pointed out, that this was really missing and supported the implementation with a little test-project for this use-case. Learn more…

Support for Hibernate Envers

Another new feature of this release is support for Hibernate Envers – Easy Entity Auditing. Thanks a lot to Victor Tatai, how implemented this, and Erik-Berndt Scheper, who helped integrating it and who supported the testin with a little test-project, that demonstrates the new feature. You can visit it at bitbucket as a starting point for your own experiments with this technique.

Less bugs!

Many thanks also to Stephen Johnson and Eduard Szente, who pointed out bugs and helped eleminating them…

Get your hands on – on central!

hibernate4-maven-plugin 1.0.3 is available in the Central Maven Repository.

Release notes:


commit adb20bc4da63d4cec663ca68648db0f808e3d181
Author: Kai Moritz
Date: Fri Oct 18 01:52:27 2013 +0200

Added missing documentation for skip-configuration

commit 99a7eaddd1301df0d151f01791e3d177297670aa
Author: Kai Moritz
Date: Fri Oct 18 00:38:29 2013 +0200

Added @since-Annotation to configuration-parameters

commit 221d977368ee1897377f80bfcdd50dcbcd1d4b83
Author: Kai Moritz
Date: Wed Oct 16 01:18:53 2013 +0200

The plugin now scans for annotated classes in dependencies too

commit ef1233a6095a475d9cdded754381267c5d1e336f
Author: Kai Moritz
Date: Wed Oct 9 21:37:58 2013 +0200

Project-Documentation now uses the own skin juplo-skin

commit 84e8517be79d88d7e2bec2688a8f965f591394bf
Author: Kai Moritz
Date: Wed Oct 9 21:30:28 2013 +0200

Reworked APT-Documentation: page-titles were missing

commit f27134cdec6c38b4c8300efb0bb34fc8ed381033
Author: Kai Moritz
Date: Wed Oct 9 21:29:30 2013 +0200

maven-site-plugin auf Version 3.3 aktualisiert

commit d38b2386641c7ca00f54d69cb3f576c20b0cdccc
Author: Kai Moritz
Date: Wed Sep 18 23:59:13 2013 +0200

Reverted to old behaviour: export is skipped, when maven.test.skip=true

commit 7d935b61a3d80260b9cacf959984e14708c3a96b
Author: Kai Moritz
Date: Wed Sep 18 18:15:38 2013 +0200

No configuration for hibernate.dialect might be a valid configuration too

commit caa492b70dc1daeaef436748db38df1c19554943
Author: Kai Moritz
Date: Wed Sep 18 18:14:54 2013 +0200

Improved log-messages

commit 2b1147d5e99c764c1f6816f4d4f000abe260097c
Author: Kai Moritz
Date: Wed Sep 18 18:10:32 2013 +0200

Variable "envers" should not be put into hibernate.properties

"hibernate.exoprt.envers" is no Hibernate-Configuration-Parameter.
Hence, it should not be put into the hibernate.properties-file.

commit 0a52dca3dd6729b8b6a43cc3ef3b69eb22755b0a
Author: Erik-Berndt Scheper
Date: Tue Sep 10 16:18:47 2013 +0200

Rename envers property to hibernate.export.envers

commit 0fb85d6754939b2f30ca4fc18823c5f7da1add31
Author: Erik-Berndt Scheper
Date: Tue Sep 10 08:20:23 2013 +0200

Ignore IntelliJ project files

commit e88830c968c1aabc5c32df8a061a8b446c26505c
Author: Victor Tatai
Date: Mon Feb 25 16:23:29 2013 -0300

Adding envers support (contribution from Victor Tatai)

commit e59ac1191dda44d69dfb8f3afd0770a0253a785c
Author: Kai Moritz
Date: Tue Sep 10 20:46:55 2013 +0200

Added Link to old Version 1.0.2 in documentation

commit 97a45d03e1144d30b90f2f566517be22aca39358
Author: Kai Moritz
Date: Tue Sep 10 20:29:15 2013 +0200

Execution is only skipped, if explicitly told so

commit 8022611f93ad6f86534ddf3568766f88acf863f3
Author: Kai Moritz
Date: Sun Sep 8 00:25:51 2013 +0200

Upgrade to Scannotation 1.0.3

commit 9ab53380a87c4a1624654f654158a701cfeb0cae
Author: Kai Moritz
Date: Sun Sep 8 00:25:02 2013 +0200

Upgrade to Hibernate 4.2.5.Final

commit 5715c7e29252ed230389cfce9c1a0376fec82813
Author: Kai Moritz
Date: Sat Aug 31 09:01:43 2013 +0200

Fixed failure when target/classes does not exist when runnin mvn test phase

Thanks to Stephen Johnson

Details from the original email:
---------
The following patch stops builds failing when target/classes (or no main java exists), and target/test-classes and src/tests exist.

So for example calling

mvn test -> invokes compiler:compile and if you have export bound to process-classes phase in executions it will fail. Maybe better to give info and carry on. Say for example they want to leave the executions in place that deal with process-classes and also process-test-classes but they do not want it to fail if there is no java to annotate in src/classes. The other way would be to comment out the executions bound to process-classes. What about export being bound to process-class by default? Could this also cause issues?

In either case I think the plugin code did checks for src/classes directory existing, in which case even call "mvn test" would fail as src/classes would not exist as no java existed in src/main only in src/test. Have a look through the patch and see if its of any use.

commit 9414e11c9ffb27e195193f5fa53c203c6297c7a4
Author: Kai Moritz
Date: Sat Aug 31 11:28:51 2013 +0200

Improved log-messages

commit da0b3041b8fbcba6175d05a2561b38c365111ed8
Author: Kai Moritz
Date: Sat Aug 31 08:51:03 2013 +0200

Fixed NPE when using nested classes in entities with @EmbeddedId/@Embeddable

Patch supplied by Eduard Szente

Details:
----------------
Hi,

when using your plugin for schema export the presence of nested classes
in entities (e.g. when using @EmbeddedId/@Embeddable and defining the Id
within the target entity class)
yields to NPEs.

public class Entity {

@EmbeddedId
private Id id;

@Embeddable
public static class Id implements Serializable {
....
}

}

Entity.Id.class.getSimplename == "Id", while the compiled class is named
"Entity$Id.class"

Patch appended.

Best regards,
Eduard

Bidirectional Association with @ElementCollection

Have you ever wondered, how to map a bidirectional association from an entity to the instances of its element-collection? Actually, it is very easy, if you are using hibernate. It is just somehow hard to find in the documentation, if you are searching for it (look for chapter 2.4.3.4 in the Hibernate-Annotationss-Documentation).

Hibernate

So, here we go:
Just add the @Parent-annotation to the attribute of your associated @Embeddable-class, that points back to its parent.

@Entity
class Cat
{
  @Id
  Long id;

  @ElementCollection
  Set kittens;

  ...
}

@Embeddable
class Kitten
{
  // Embeddable's have no ID-property!

  @Parent
  private Cat mother;

  ...
}

Drawback

But this clean approach has a drawback: it only works with hibernate. If you work with other JPA-implementations or plain old JPA itself, it will not work. Hence, it will not work in googles appengine, for example!

Unfortunatly, there are no clean workarounds, to get bidirectional associations to @ElementCollections‘s working with JPA. The only workarounds I found, only work for directly embedded instances – not for collections of embedded instances:


If you want bidirectiona associations to the elements of your embedded collection, it works only with hibernate!

hibernate4-maven-plugin 1.0.2 released!

Today we released the version 1.0.2 of hibernate4-maven-plugin to Central.

This release includes:

  • Improved documentation (thanks to Adriano Machado)
  • Support for the hibernateNamingStrategy-configuration-option (thanks to Lorenzo Nicora)
  • Mapping via *.hbm.xml-files (old approach without annotations)

hibernate4-maven-plugin 1.0.2 is available in the Central Maven Repository.

Release notes:


commit 4edef457d2b747d939a141de24bec5e32abbc0c7
Author: Kai Moritz
Date: Fri Aug 2 00:37:40 2013 +0200

Last preparations for release

commit 82eada1297cdc295dcec9f43660763a04c1b1deb
Author: Kai Moritz
Date: Fri Aug 2 00:37:22 2013 +0200

Upgrade to Hibernate 4.2.3.Final

commit 3d355800b5a5d2a536270b714f37a84d50b12168
Author: Kai Moritz
Date: Thu Aug 1 12:41:06 2013 +0200

Mapping-configurations are opend as given before searched in resources

commit 1ba817af3ae5ab23232fca001061f8050cecd6a7
Author: Kai Moritz
Date: Thu Aug 1 01:45:22 2013 +0200

Improved documentaion (new FAQ-entries)

commit 02312592d27d628cc7e0d8e28cc40bf74a80de21
Author: Kai Moritz
Date: Wed Jul 31 23:07:26 2013 +0200

Added support for mapping-configuration through mapping-files (*.hbm.xml)

commit b6ac188a40136102edc51b6824875dfb07c89955
Author: nicus
Date: Fri Apr 19 15:27:21 2013 +0200

Fixed problem with NamingStrategy (contribution from Lorenzo Nicora)

* NamingStrategy is set explicitly on Hibernate Configuration (not
passed by properties)
* Added 'hibernateNamingStrategy' configuration property

commit c2135b5dedc55fc9e3f4dd9fe53f8c7b4141204c
Author: Kai Moritz
Date: Mon Feb 25 22:35:33 2013 +0100

Integration of the maven-plugin-plugin for automated helpmojo-generation

Thanks to Adriano Machado, who contributed this patch!

hibernate4-maven-plugin 1.0.1 released!

Today we released the bugfix-version 1.0.1 of hibernate4-maven-plugin to Central.

Appart from two bugfixes, this version includes some minor improvements, which might come in handy for you.

hibernate4-maven-plugin 1.0.1 should be available in the Central Maven Repository in a few hours.

Release notes:


commit 4b507b15b0122ac180e44b8418db8d9143ae9c3a
Author: Kai Moritz
Date: Tue Jan 15 23:09:01 2013 +0100

Reworked documentation: splited and reorderd pages and menu

commit 65bbbdbaa7df1edcc92a3869122ff06a3895fe57
Author: Kai Moritz
Date: Tue Jan 15 22:39:39 2013 +0100

Added breadcrumb to site

commit a8c4f4178a570da392c94e384511f9e671b0d040
Author: Kai Moritz
Date: Tue Jan 15 22:33:48 2013 +0100

Added Google-Analytics tracking-code to site

commit 1feb1053532279981a464cef954072cfefbe01a5
Author: Kai Moritz
Date: Tue Jan 15 22:21:54 2013 +0100

Added release information to site

commit bf5e8c39287713b9eb236ca441473f723059357a
Author: Kai Moritz
Date: Tue Dec 18 00:14:08 2012 +0100

Reworked documentation: added documentation for new features etc.

commit 36af74be42d47438284677134037ce399ea0b58e
Author: Kai Moritz
Date: Tue Jan 15 10:40:09 2013 +0100

Test-Classes can now be included into the scanning for Hibernate-Annotations

commit bcf07578452d7c31dc97410bc495c73bd0f87748
Author: Kai Moritz
Date: Tue Jan 15 09:09:05 2013 +0100

Bugfix: database-parameters for connection were not taken from properties

The hibernate-propertiesfile was read and used for the configuration of
the SchemaExport-class, but the database-parameters from these source were
ignored, when the database-connection was opened.

commit 54b22b88de40795a73397ac8b3725716bc80b6c4
Author: Kai Moritz
Date: Wed Jan 9 20:57:22 2013 +0100

Bugfix: connection was closed, even when it was never created

Bugreport from: Adriano Machado

When only the script is generated and no export is executed, no database-
connection is opend. Nevertheless, the code tried to close it in the
finally-block, which lead to a NPE.

commit b9ab24b21d3eb65e2a2208be658ff447c1846894
Author: Kai Moritz
Date: Tue Dec 18 00:31:22 2012 +0100

Implemented new parameter "force"

If -Dhibernate.export.force is specified, the schema-export will be forced.

commit 19740023bb37770ad8e08c8e50687cb507e2fbfd
Author: Kai Moritz
Date: Fri Dec 14 02:16:44 2012 +0100

Plugin ignores upper- or lower-case mismatches for "type" and "target"

commit 8a2e08b6409034fd692c4bea72058f785e6802ad
Author: Kai Moritz
Date: Fri Dec 14 02:13:05 2012 +0100

The Targets EXPORT and NONE force excecution

Otherwise, an explicitly requestes SQL-export or mapping-test-run would be
skipped, if no annotated class was modified.

If the export is skipped, this is signaled via the maven-property
hibernate.export.skipped.

Refactored name of the skip-property to an public final static String

commit 55a33e35422b904b974a19d3d6368ded60ea1811
Author: Kai Moritz
Date: Fri Dec 14 01:43:45 2012 +0100

Configuration via properties reworked

* export-type and -target are now also configurable via properties
* schema-filename, -delemiter and -format are now also configurable via
porperties

commit 5002604d2f9024dd7119190915b6c62c75fbe1d6
Author: Kai Moritz
Date: Thu Dec 13 16:19:55 2012 +0100

schema is now rebuild, when SQL-dialect changes

commit a2859d3177a64880ca429d4dfd9437a7fb78dede
Author: Kai Moritz
Date: Tue Dec 11 17:30:19 2012 +0100

Skipping of unchanged scenarios is now based on MD5-sums of all classes

When working with Netbeans, the schema was often rebuild without need.
The cause of this behaviour was, that Netbeans (or Maven itself) sometimes
touches unchanged classes. To avoid this, hibernat4-maven-plugin now
calculates MD5-sums for all annotated classes and compares these instead of
the last-modified value.

commit a4de03f352b21ce6abad570d2753467e3a972a10
Author: Kai Moritz
Date: Tue Dec 11 17:02:14 2012 +0100

hibernate4:export is skipped, when annotated classes are unchanged

Hbm2DdlMojo now checks the last-modified-timestamp of all found annotated
classes and aborts the schema-generation, when no class has changed and no
new class was added since the last execution.

It then sets a maven-property, to indicate to other plugins, that the
generation was skipped.

commit 2f3807b9fbde5c1230e3a22010932ddec722871b
Author: Kai Moritz
Date: Thu Nov 29 18:23:59 2012 +0100

Found annotated classes get logged now

hibernate4-maven-plugin 1.0 released!

Yeah! We successfully released our first artifact to Central.

hibernate4-maven-plugin is now available in the Central Maven Repository

That means, that you now can use it without manually downloading and adding it to your local repository.

Simply define it in your plugins-section…


  de.juplo
  hibernate4-maven-plugin
  1.0

…and there you go!

hibernate4-maven-plugin

A simple Plugin for generating a Database-Schema from Hibernate 4 Mapping-Annotations

Hibernate comes with the buildin functionality, to automatically create or update the database schema. This functionality is configured in the session-configuraton via the parameter hbm2ddl.auto (see Hibernate Reference Documentation – Chapter 3.4. Optional configuration properties). But doing so is not very wise, because you can easily corrupt or erase your production database, if this configuration parameter slips through to your production environment.

Alternatively, you can run the tools SchemaExport or SchemaUpdate by hand. But that is not very comfortable and being used to maven you will quickly long for a plugin, that does that job automatically for you, when you fire up your test cases.

In the good old times, there was the Maven Hibernate3 Plugin, that does this for you. But unfortunatly, this plugin is not compatible with Hibernate 4.x. Since there does not seem to be any successor for the Maven Hibernate3 Plugin and googeling does not help, I decided to write up this simple plugin (inspired by these two articles I found: Schema Export with Hibernate 4 and Maven and Schema generation with Hibernate 4, JPA and Maven).

I hope, the resulting simple to use buletproof hibernate4-maven-plugin is usefull!

Try it out now!