Business Validations in one place using Hibernate Validator Framework

Validating business data is a must in almost all applications. So far the common approach had been to define these constraints at multiple Tier – Web , Business and Data. This results in duplicated and distributed  validation logic.

Hibernate Validator is a annotations based framework that consolidates this logic in one place (JPA Entity Beans). It’s pretty useful for the standard and simple validations like ‘not null’, length checks. For complex validations you can define your own validators. Its not a standard yet but JSR 303:Bean Validation is in progress and this was something that was inspired by Validator framework.

It integrates pretty well with Hibernate (No surprises there!!) letting the constraints included in the generated DDLs. It also can be combined with other JPA providers but needs some special configurations.

Validations are executed automatically prior to data inserts/updates. You can also call them programmatically using the API and if you Seam then you get seamless integration with JSF. So in a nutshell, the same validation logic can be used in Web, Business and Data tiers.

Its a simple framework and deserves a look!

RK

Find Singapore Apartment  and Room Rentals here

Looking for a date or love? Click here to find one for free!!

Stock Market Views, Experiences on http://theindiastockmarket.blogspot.com/

This entry was posted in Technology and tagged , , , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s