Tags
Authors
We used to be very conservative on the constraints included in Hibernate Validator but we changed this policy recently and we would like to have more constraints built-in.
Of course, we won’t accept everything: the proposed constraints needs to be of general usage and well defined but the idea is to have more features in Hibernate Validator out of the box.
This post will be useful to those who have some interesting custom Bean Validation constraints and want to share them with the community.
[ ... ]
We just released the 6.0.7.Final version of Hibernate Validator containing a couple of enhancements.
This is a recommended upgrade for everyone using Hibernate Validator 6.0.x and it is a drop-in replacement of 6.0.5.Final.
One of the most exciting features in Java 9 are modular runtime images. Using the new jlink utility, you can create customized distributions which contain your app, its dependencies and just the JDK modules which it needs. For instance, a simple service based on the Undertow web server can be packaged into an image of just 25 MB, batteries included.
While that’s pretty cool already, it gets even nicer, as jlink provides a plug-in mechanism which allows to fine-tune the contents modular runtime images as they are created. There’s a set of jlink plug-ins coming with the JDK, e.g. for compressing image contents or removing debug symbols. But many more use cases may benefit from this API, for instance one could imagine plug-ins for removing un-used code or for performing byte code instrumentation of JPA entities. In the following, we’ll create a plug-in for adding an annotation index to the created image. At runtime, this index can then be used to discover annotations very efficiently, i.e. without loading classes and using reflection.
Sound great?
For sure it does, there’s just one catch: the jlink plug-in API is not a supported part of the JDK as of Java 9.
In fact, its packages are not even exported from the jdk.jlink
module.
This means some tricks are required to create custom plug-ins and run the jlink tool with these plug-ins enabled.
The API may change in future Java versions, so any custom plug-in may break.
Nevertheless it’s definitely worth to explore the API and see what it can do. It’s my hope that it’ll be promoted to a public API eventually.
Welcome to the Hibernate community newsletter in which we share blog posts, forum, and StackOverflow questions that are especially relevant to our users.
Without doubt, the module system (JPMS) is the most prominent feature of Java 9. But there are many other useful additions to the JDK, which have not been discussed as widely yet.
One of them is the new ToolProvider
SPI, which defines a uniform way to invoke all the tools coming with the JDK (e.g. jar
, jlink
etc.) in a programmatic way.
E.g. imagine you’d like to create a JAR archive from within your Java application.
Before Java 9, you had two options to do so:
-
Start a separate process to run the
jar
binary -
Find out which classes are used by the
jar
command internally and invoke them directly
Neither option is ideal.
The former incurs some overhead for forking an OS level process and it requires a bit of coding to locate the binary to execute in the Java home directory and to correctly capture any output of the forked process.
The second option doesn’t come with the disadvantages of forking a new process, but it requires knowledge about the implementation of the tool to execute.
So for instance in the case of the jar
command, you’d have to know that java.util.jar.JarOutputStream
is used to produce JAR files.
Originally started as a Google Summer of Code project by Mincong Huang, Hibernate Search 5.9 will feature integration with JSR 352, "Batch Applications for the Java Platform". This integration provides a new implementation of mass indexing (indexing a high volume of entities) as a JSR 352 job.
Yesterday we released 5.9.0.Beta1 so you can try it out already!
Why is it nice? How to use it? Let’s find out!
We just published 5.9.0.Beta1, the first beta release for the 5.9 branch. This release brings several bug fixes, but most importantly a new mass indexer based on the JSR 352 specification, "Batch Applications for the Java Platform"!
Welcome to the Hibernate community newsletter in which we share blog posts, forum, and StackOverflow questions that are especially relevant to our users.
We just released the 6.0.5.Final version of Hibernate Validator containing a couple of important bugfixes and some enhancements.
This is a recommended upgrade for everyone using Hibernate Validator 6.0.x and it is a drop-in replacement of 6.0.4.Final.
Welcome to the Hibernate community newsletter in which we share blog posts, forum, and StackOverflow questions that are especially relevant to our users.