Platinum Sponsors

SUN

ELCA

Gold Sponsors

Silver Sponsors

Partners

Partner events

Emmanuel Bernard

Emmanuel Bernard

(3820) JSR-303: From a world of Constraints to Constrain the world

Technical long talk 50 min

Wednesday, 2008-06-25, 15:00 - 15:50, Arena 8

Emmanuel Bernard - JBoss, a division of Red Hat (speaker)

Topics

Download the presentation

Abstract

Constraints are at the very core of our data, they help increase quality and 
relevance. Validating the data as often as possible is thus a good step towards 
the quality road. 
In traditional Java applications, validation are applied at different levels and 
different layers, typically:
 - the database layer (table / column constraints)
 - the ORM layer
 - the service layer
 - the presentation layer
 - the client side layer 

Unfortunately, this leads to constraint declaration duplications for each layer 
and increases the risk of inconsistencies.

This presentation will describe how JSR-303: Bean Validation addresses this 
problem for the Java platform. The attendees will be described the three main 
components of the solution as well as when and how this specification will fit 
into the Java SE and EE ecosystem. 

How to express a constraint 
Declaring constraints should be done with no duplication, and be as close as 
possible to the data structure: our objects. This presentation will show how 
declaring a constraint is as simple as putting an annotation on a field or a 
property and how to validate an object graph. Some more advanced topic will be 
covered too such as: 
 - custom constraint definition and implementation through the JSR-303 extension 
mechanism, 
 - constraints grouping to declare use case specific constraints,
 - short circuit i.e. the ability to stop a validation process when a given 
constraint fails. 

How to validate an object 
JSR-303 provides a unified and standard API to apply the object validation 
routine whether it be by a JSR (like Java Persistence 2 and Java Server Faces), 
a framework or an application. This presentation will cover this API as well as 
the information provided when one or more failure happen. The customization and 
internationalization of the constraint failure messages will be described as 
well.

Integrating beyond Java 
Beyond object instance validation, the presentation will cover JSR-303's ability 
to query and access the constraint metadata repository. The attendee will see 
how such informations about the constraints will be reused by frameworks 
interacting with the Object world boundaries such as Java Persistence 2 or Java 
Server Faces 2 components. 

No prerequisite knowledge is necessary aside Java 5.

Media Partners

APRESS
inside-it
netzwoche
developpez
MokaByte