Saturday, November 7, 2009

Bookmark and Share

My article "Objekt: Zur Prüfung bitte!" covering the Bean Validation API (JSR 303) is available for download now. It originally appeared in Java Magazin 09.09.

Since the time of writing JSR 303 reached its final state, but besides some minor changes the article is still up to date (e.g. it's "Payload" instead of "ConstraintPayload" now). More in-depth information on using the Bean Validation API and its reference implementation Hibernate Validator 4 can be found in Hibernate Validator's reference guide, which I co-authored.

3 comments:

Anonymous said...

I wonder if there is an english translation of your article.

Gunnar Morling said...

The article is available in German only.

Did you take a look at the reference guide of Hibernate Validator already? It should help getting started with the API.

gerg said...

My IDE (Eclipse 3.5.1) found some possible errors in the Hibernate Validator reference guide:

a. Example 4.2, “validation.xml” line 3:

xsi:schemaLocation="http://jboss.org/xml/ns/javax/validation/configuration">

includes the namespace but is missing the xsd location. Should be:

xsi:schemaLocation="http://jboss.org/xml/ns/javax/validation/configuration validation-configuration-1.0.xsd">


b. Example 4.4, “constraints-car.xml” last element “constraint-definition”:

<constraint-definition annotation="org.mycompany.CheckCase" include-existing-validator="false">
<validated-by include-existing-validators="false">


Attribute 'include-existing-validator' is not allowed to appear in element 'constraint-definition'. I think the 'include-existing-validators' attribute on the 'validated-by' element is sufficient here.