The main idea behind JSR-303 is to have a common approach for validation at all places of the application in a simplistic way. The bean validation is built keeping in mind the validation process as a kind of meta information for a bean, so if you say that a property of bean should be not null or the content of a bean property should match to the format of e-mail or telephone. Such kind of information can be treated as meta-information of bean properties. One of the other motive for having JSR-303 into picture is to remove the boilerplate code introduced due to the need of bean validation at multiple places in the application, such as at UI level, while persisting a bean or performing some business operation.
JSR-303 provides bean validation using two ways, either you can configure validations using annotations on properties or using a XML validation descriptor. Annotations can be used as Meta-data for bean validation in case of some simple validations such as not null, e-mail, telephone number check. XML validation descriptor is used for some complex validations or context aware validation.
JSR-303 also defines API for Java Bean validation, so this API can be used to programmatically validate the bean .
In my current project we are working on a web-application using JBoss Seam. One of the very common requirements while working on a web application is validating the data contained in a bean. Seam is powered with annotation based validation, seam uses Hibernate Validator for this feature. Hibernate validator is a reference implementation of Bean Validation (JSR-303).JSR-303 defines a meta-data model and API for JavaBean validation based on annotations.
In my coming posts I’ll be focussing on JSR-303 and it’s reference implementations. Some of the posts I’m thinking of right now
– Bean Validation JSR-303
– Hibernate Reference implementation
– Using Hibernate Validation, accessing it programmatically
– Creating custom annotation validator
So a new year has begun it’s the time to plan things for this year. It’s good to plan things in advance 🙂 atleast you dont need to plan every time, you already have things that you need to focus right :).
Initially I’ll be focussing on Seam, as in my current project I’m working on seam, since it’s a new technology for me so a lot needs to be learnt in it.
Other things on which I’ll be wroking will be Java EE6, Spring, JPA . Other then this I’ll be picking something as of interest so right now I’m thinking of mobile applications.
Let’s see how things go this year. Happy blogging 🙂