Red Hat

In Relation To Hardy Ferentschik

In Relation To Hardy Ferentschik

Hibernate Validator 4.0.0 CR1

Posted by    |       |    Tagged as Hibernate Validator

The dust is settling around JSR-303 and we are happy to release Hibernate Validator 4.0.0.CR1. With this release we will be going into feature freeze, especially since we aligned it with JBoss AS 5.2 and Glassfish for integration.

Most of the work since Beta3 was spend on completing the Bean Validation TCK and ensuring that we cover all the assertions from the specification. We are really happy that we managed to create a TCK with readable and easy to understand tests. In fact, the TCK is an excellent source for usage examples. You can read more about the TCK on the Bean Validation TCK wiki page.

Regarding the actual changes to the Hibernate Validator codebase refer to the Jira release notes. From the changes listed there the following are worth mentioning seperately:

  • Hibernate Validator is now able to run in an environment with enabled SecurityManager (HV-171)
  • The package structure has changed from org.hibernate.validation to org.hibernate.validator
  • And the main Provider class name has changed from HibernateValidatorProvider to HibernateValidator

Refer to the Hibernate Validator Migration Guide to see what this means for you.

JBoss AS 5.2 beta is around the corner and it will have Bean Validation (Hibernate Validator) inside. Things are really coming together :)


Hibernate Search 3.1.1 GA

Posted by    |       |    Tagged as Hibernate Search

With work on version 3.2 of Hibernate Search well underway and a range of very interesting features in the pipeline (eg programmatic configuration API, bulk indexing and dynamic boosting), we decided to provide some of the bug fixes also for the 3.1 version of Hibernate Search. Hence here is Hibernate Search 3.1.1 GA. On top of several bug fixes which are listed in the release notes we also upgraded Lucene from 2.4 to 2.4.1.

We recommend users of version 3.1 to upgrade to 3.1.1 to come into the benefits of these bug fixes.

You can download the release here.


Hibernate Validator 4.0.0 Beta1

Posted by    |       |    Tagged as

The first beta version of Hibernate Validator - 4.0.0 Beta1 - is now available. This version is based on JSR 303 Specification 1.0.CR2[1].

New in this release is the ability to configure Hibernate Validator via XML (see section 7 of the specification[1]). There are two types of configuration files. Firstly, validation.xml which allows to programmatically configure your Bean Validation framework. Here is an example, which specifically states the Bean Validation Provider and message interpolator. It also specifies the location of further mapping files:

<?xml version="1.0" encoding="UTF-8"?>
<validation-config xmlns=""
    xsi:schemaLocation=" validation-configuration-1.0.xsd"
    <property name="org.hibernate.validator.test">foobar</property>

The second type of XML configuration files are the actual mapping file which let you declare constraints declarations. The XML matches closely the annotation declaration approach. user-constraints.xml as used in the above example could look like this:

<constraint-mappings xmlns:xsi=""
                     xsi:schemaLocation=" validation-mapping-1.0.xsd"
    <bean class="User" ignore-annotations="false">
        <class ignore-annotations="true">
            <constraint annotation="org.hibernate.validation.engine.xml.ConsistentUserInformation">
                <message>Message defined in xml</message>
                <element name="stringParam">foobar</element>
        <field name="lastname">
            <constraint annotation="javax.validation.constraints.Pattern">
                <message>Last name has to start with with a capital letter.</message>
                <element name="regexp">^[A-Z][a-z]+</element>
        <field name="creditcard">
        <getter name="firstname" ignore-annotations="true">
            <constraint annotation="javax.validation.constraints.Size">
                <message>Size is limited!</message>
                <element name="max">30</element>
    <constraint-definition annotation="org.hibernate.validation.engine.xml.ConsistentUserInformation">
        <validated-by include-existing-validators="false">

with a matching User entity of :

public class User {

	private String firstname;
	private String lastname;
	private CreditCard creditcard;
	private String phoneNumber;

        // standard getter and setter follow

This first beta release is nearly feature complete now, except some minor discrepancies between implementation and specification due to ongoing specification work. We are aiming at least one more beta release to completely align implementation and specification. Work on this has already started and the outcome will be a Bean Validation TCK. The foundation for the TCK is build on the JSR 299 TCK framework. Thanks guys ;-) Of course we will also try to complete our reference documentation as fast as possible.

Any feedback for the release is welcome.


Hibernate Validator 4.0.0 Alpha3

Posted by    |       |    Tagged as

Hibernate Validator version 4.0.0 Alpha3 is of now available. This implementation is based on JSR 303 Specification 1.0.CR1[1]. The distribution packages contain everything you need to get started.

As promised in the last post implicit grouping is now available. On top of this the metadata API is now in sync with the current spec and there is a JPA 2 aware TraversableResolver. @Valid supports now Iterables and the cascading algorithm follows the new graph navigation rules. In the previous releases an object instance would only be validated once per group. Now this instance can be validated once per group AND validation path. Lets look at the object graph below to illustrate the change:

Assuming a @NotNull constraint on Address.addressLine validating the shown Order instance against the default group will now result in three ConstraintViolations differing only in the property path. The paths are:

  • shippingAddress.addressline1
  • customer.addresses[0].addressline1
  • billingAddress.inhabitant.addresses[0].addressline1

Previously only one ConstraintViolation would have returned and it was not defined which property path it would contain. Last but not least the ConstraintValidator resolution algorithm got revamped and works now with generics. This allows support for constructs like:

Collection<? extends Number> element;

For further information about this release refer to the Jira change log and please provide us with some feedback.


Hibernate Validator 4.0.0 Alpha2

Posted by    |       |    Tagged as

Following the Roadmap version 4.0.0 Alpha2 of Hibernate Validator is now available. This implementation is based on JSR 303 Specification 1.0.Beta4[1]. The distribution contains everything you need to get started. If not let us know what you are missing.

The main focus for this release was to implement groups, group sequences and the redefinition of the Default group for a class. Implicit grouping will be available in the next release. Next to the grouping feature ConstraintValidatorContext and TraversableResolver are now properly integrated in the implementation and all builtin constraints as per current spec are also supported.

Naturally there were also several unrelated bug fixes, especially around the methods Validator.validateValue and Validator.validateProperty. Check the change log if you want to know more.

It would be great if you could try out this release and provide us with some feedback.


Hibernate Search Clustering with Terracotta

Posted by    |       |    Tagged as Hibernate Search


I just thought that the release of Hibernate Search 3.1.0.Beta2 would be a good time to announce another clustering possibility for Hibernate Search - Terracotta clustering. Why would one use Terracotta? Well, there are several potential benefits of Terracotta clustering over the default JMS clustering currently used by Hibernate Search?

  • Updates to the index are immediately visible to all nodes in the cluster
  • You don't have the requirement of a shared file system
  • The faster RAMDirectory is used instead of the slower FSDirectory

But let's get started. You can download the code for the following example here or you can just download the binary package. At the moment the code is not yet part of the Search codebase, but probably it will at some stage.

First you will need to download and install Terracotta. I am using the 2.6.2 release. Just unpack the release into a arbitrary directory. I am using /opt/java/terracotta. Next you will the main Compass jar. You can use this jar. Place this jar into the modules directory of your terracotta installation. This solution does not rely on any Compass classes per se, but utilizes a custom RAMDirectoy implementation - org.compass.needle.terracotta.TerracottaDirectory. This is required since Lucene's RAMDirectory is not Terracotta clusterable out of the box. Let's start the terracotta server now. Switch into the bin directory of your terracotta installation and run ./ Check the log to see whether the server started properly.

Next download and extract hsearch-demo-1.0.0-SNAPSHOT-dist.tar.gz. The dist package currently assumes that you have a mysql database running with a database hibernate and a username/password of hibernate/hibernate. You can change these settings and use a different database if you build the dist package from the source, but more to this later. The dist further assumes that you have installed Terracotta under /opt/java/terracotta. If this is not the case you can change the repository node in config/tc-config.xml. Provided that you have a running mysql database and tc-config.xml properly reflects your terracotta installation directory things should be as easy as just typing ./ The scripts will ask you whether you want to start a standalone application or a terracotta clustered one. Just press 't' to start a terracotta clustered app. You should get up a Swing JTable:

Press the index button to create an initial index. The data model is based on the former Seam sample DVD store application. Once the index is created just search for example for Tom. You should get a list of DVDs in the table. Experiment a little with the application and different queries. When you are ready start a second instance of the application by running ./ again. You won't have to create the index again. In the second instance the DVDs should be searchable right away. You can also edit the title field of a DVD in one application and search for the updated title in the other. Also try closing both applications and restarting a new instance. Again DVDs should be searchable right away. The Terracotta server keeps a persistent copy of the clustered Lucene directory.

Ok, now it is time to build the application from the source. This will allow you to actually inspect the code and change things like database settings. Donwload hsearch-demo-1.0.0-SNAPSHOT-project.tar.gz and unpack the tarball. Import the maven project in your preferred IDE. To build the project you will need to define the following repositories in your settings.xml:


If you want to use a different database you can add/modify the profiles section in pom.xml. Also have a look at src/main/scripts/tc-config.xml and adjust any settings which differ in your setup. Once you are happy with everything just run mvn assembly:assembly to build your own version of the application.

I basically just started experimenting with this form of clustering and there are still several open questions:

  • How does it perform compared to the JMS clustering?
  • What are the limits for the RAMDirectory size?
  • How can I add failover capabilities?

I am planning to do some more extensive performance tests shortly. Stay tuned in case you are interested.


P.S. It would be great if someone actually tries this out and let me know if it works. As said, it's still work in progress. Any feedback is welcome :)

Herbstcampus Nürnberg

Posted by    |       |    Tagged as Hibernate Search

Just came back from Nürnberg where I was invited to present Hibernate Search at the Herbstcampus conference. It was the first year for this conference with the hope of making it an established yearly event. Given that already in the first year over 200 people showed up Herbstcampus might be on the right track.

While in Nürnberg I started putting together a simple Hibernate Search demo. What I wanted was just the bare bone minimum to get things running. I ended up with a simple Swing GUI with a couple of buttons and a JTable. In case you are interested check it out on the Hibernate Wiki.

On the culinary side I had the luck that this week was also the yearly Nürnberger Altstadtfest. I ended up spending a couple of hours walking around the stalls and sampling some Nürnberger Rostbratwürste and Lebkuchen. Yummi :)

Finally some pictures from Nürnberg:


Validator 3.1.0.GA Release

Posted by    |       |    Tagged as

Last month we released GA versions of Hibernate Annotations and EntityManager, but only a CR for Validator. This has changed of today with the release of Validator 3.1.0.GA.

Basically not much is happening on the Hibernate Validator, since we are focusing on the implementation of the BeanValidation (JSR 303) specification. If you want to know what's happening in this project check out the forum or jira.


JBUG Munich

Posted by    |       |    Tagged as

Just waiting for my flight back to Sweden after being invited to present Hibernate Search at the monthly JBUG Munich meeting. I was pleasantly suprised that despite school holidays a respectable crowd showed up for the meeting. The feedback was throughout positiv and hopefully there are now a few new Search convertees spreading the word in Munich.

One question which popped up was whether the performance of Hibernate Search is somehow quantifiable. Of course the same applies here for Hibernate Search as for Core (see - each application is different and it is hard to find a fair and compareable benchmark. I wonder though whether some specific benchmarks similar to the ones posted on the Lucene homepage would make sense.

Last but not least - the highlight of the evening - German wheat beer after the presentation. That alone was worth the trip ;-)


Without much ado I am happy to announce the following releases:

  • commons-annotations 3.1.0.CR2
  • annotations 3.4.0.CR2
  • entitymanager 3.4.0.CR2

Being maintenance releases there is not much to say about them. Changes to commons-annotations and entitymanager are minimal with most work being put into bug fixes in Annotations. Check out the change logs if you want to know more.

BTW, all these new releases are aligned with Steve's 3.3.0.CR2 release of Core.

back to top