It has been a while since the first alpha release of Validator 5.1, but as the saying goes: Haste makes waste :-) There is a lot going on in the Hibernate universe and over the last few months we have been especially busy with projects like Search and OGM. Not to speak of the new Hibernate website. Sigh, if we just had more contributors lending a hand (hint, hint).

Nevertheless, we found time to also work on Validator and the result is Hibernate Validator 5.1.0.Beta1 with some nice new features and bug fixes. The most notable feature is the introduction of @UnwrapValidatedValue and the corresponding ValidatedValueUnwrapper SPI (see HV-819). The idea is that in some cases the value to validate is contained in a wrapper type and one would have to add custom ConstraintValidator implementations for each constrained type and constraint. Think Java 8 Optional or JavaFX Property types. For example in JavaFX you could have:

private Property<String> name = new SimpleStringProperty( "Foo" );
Here the intention is to apply the @NotBlank constraint to the string value, not the the Property instance. By annotating name with @UnwrapValidatedValue the Validator engine knows that it has to unwrap the value prior to validation. To be able to do this, you need to also register an implementation of ValidatedValueUnwrapper which specifies how this unwrapping has to happen. You can do this via validation.xml as provider specific property (hibernate.validator.validated_value_handlers) or programmatically via:
Validator validator = Validation.byProvider( HibernateValidator.class )
        .addValidatedValueHandler( new PropertyValueUnwrapper() )
PropertyValueUnwrapper is in this case an implementation of ValidatedValueUnwrapper which tells the Validator engine how to unwrap a Property type and of which type the validated value is. The latter is needed for constraint validator resolution. For more information refer to the online documetnation.

What else is worth mentioning? Thanks to Brent Douglas for profiling of Hibernate Validator and detecting of some potential memory leaks - see HV-838 and HV-842. They are fixed now.

Thanks also to Victor Rezende dos Santos and Shin Sang-Jae. Victor found a problem with the Brazilian CPF constraint which lead to its refactoring HV-808, as well as the deprecation of @ModCheck and the introduction of dedicated @Mod10 and @Mod11 constraints as replacements. Shin on the other hand provided a Korean translation of the ValidationMessages properties bundle.

Last but not least, we also have an improved the memory footprint by reducing the amount of memory consumed by metadata (HV-589).

In total 29 resolved issues. Not bad in my opinion and definitely worth upgrading to Validator 5.1.

Maven artefacts are on the JBoss Maven repository under the GAV org.hibernate:hibernate-validator:5.1.0.Beta1 and distribution bundles are available on SourceForge. Send us feedback either via the Hibernate Validator forum or on stackoverflow using the hibernate-validator tag.


07. Feb 2014, 14:06 CET | Link

It's the great news. I'm happy tp know that the problem with the potential memory leaks has been fixed.

11. Feb 2014, 07:51 CET | Link

Thanks for taking the time to write that, I found it very educational. If you get a chance you should visit my site as well. I hope you have a great day!

02. Apr 2014, 16:36 CET | Link

And there might be lots of an instances when you would have felt embarrassed about sporting the same elderly watch when you require to attend any conference or go on an official task.Replica watches save the pride of lots of individuals who undergo these kinds of insecure feelings. Without spending a fortune you could make a style statement for your own self.Replica Rolex watches on replica pimp has become a craze with people because it meets with all these requirements.And also when you look for a replica watch you will require it to be steadfast in its performance like that of the original,which is without a doubt present in a replica Rolex watch.This watch has some brilliant features that will certainly going to take your heart.First thing that you will love about this watch is its looks. It is hence not surprising to find executive purchase over replica Rolex watches.They need to gift to their boss.They know that the best way to impress the boss is by Monogram Empreinte replica louis vuitton handbags giving him replica Rolex watches.While they are at it, they are surprised at the down to rolex replica uk earth prices of the replica Rolex watches as well as a number of them take for their spouse.

Post Comment