Question

Has the JSR 303 Bean Validation caught on yet?

I realize that it is still relatively new specification (Versions 1.0 and 1.1), but I can't even find an official tutorial on it, much less books.

Are there any commercial projects that have successfully adopted JSR 303 yet? I'm asking because there's a risk in committing to something that has a small user base. Plus, I'm not an early adapter. :)

Was it helpful?

Solution

I used JSR303 on a recent Spring/Hibernate project for a client and it worked very well. It was easy to use and setup. there are a few tutorials online if you search for JSR303 and I downloaded the Hibernate Validator reference which is their JSR303 implementation. That should get you going. I think you will see a lot more of it as time goes on. Especially if you are traveling in the Spring/Hibernate world.

OTHER TIPS

Has the JSR 303 Validation caught on yet?

Well, Bean Validation is part of Java EE 6, BV does integrate nicely with the persistence layer (JPA), BV does integrate nicely with presentation layer technologies such as JSF 2, Wicket, Spring MVC, Tapestry.

So I'd say yes, BV is there, is already used, and I expect it to be used more and more.

I realize that it is still relatively new specification, but I can't even find an official tutorial on it, much less books.

Get the spec and check the Bean Validation blog posts on JBoss blog for example (especially the Bean Validation Sneak Peek series from two years ago).

Are there any commercial projects that have successfully adopted JSR 303 yet? I'm asking because there's a risk in committing to something that has a small user base. Plus, I'm not an early adapter. :)

Yes there are. And I personally consider using a standard that is part of Java EE as pretty safe (BV is definitely going to be there for some time). What are the risks for you? And what alternative would you actually use if not BV? What make them look more or less "risky" than BV?

We are considering this as a replacement of iScreen. Here is the reference guide for the reference implementation of this spec from hibernate. Another implementation (being used in OpenJPA is http://code.google.com/p/agimatec-validation/

Continuing Progress

Bean Validation is a continuing project, with growing adoption.

Second JSR, 1.1 Spec

The original JSR 303 and its 1.0 spec was followed by JSR 349 and its 1.1 spec of 2013.

With the new JSR came an open process. This includes a dedicated web site, www.BeanValidation.org.

Currently only the Hibernate Validator is tested and certified as a full implementation Bean Validation (and is the Reference Implementation). Previously for the 1.0 spec, Apache BVal had also been certified.

Adoption

I have used the web app framework, Vaadin, with support for Bean Validation in addition to its own UI widget validation.

JSF (JavaServer Faces) supports Bean Validation 1.1 as shown in this blog post by Rama krishnan.

This Devoxx presentation by Emmanuel Bernard, the spec lead, mentions that in additionto JSF integrations exist for:

The Java API for RESTful Web Services (JAX-RS) is neatly integrated with Bean Validation to return HTTP error codes in the 400 and 500 series rather than Exceptions to signify validation constraint validations.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top