| 1 |
[[preface]] |
| 2 |
|
| 3 |
[preface] |
| 4 |
== Preface |
| 5 |
|
| 6 |
Validating data is a common task that occurs throughout all application layers, from the |
| 7 |
presentation to the persistence layer. Often the same validation logic is implemented in each layer |
| 8 |
which is time consuming and error-prone. To avoid duplication of these validations, developers often |
| 9 |
bundle validation logic directly into the domain model, cluttering domain classes with validation |
| 10 |
code which is really metadata about the class itself. |
| 11 |
|
| 12 |
image::application-layers.png[] |
| 13 |
|
| 14 |
JSR 349 - Bean Validation 1.1 - defines a metadata model and API for entity and method validation. |
| 15 |
The default metadata source are annotations, with the ability to override and extend the meta-data |
| 16 |
through the use of XML. The API is not tied to a specific application tier nor programming model. It |
| 17 |
is specifically not tied to either web or persistence tier, and is available for both server-side |
| 18 |
application programming, as well as rich client Swing application developers. |
| 19 |
|
| 20 |
image::application-layers2.png[] |
| 21 |
|
| 22 |
Hibernate Validator is the reference implementation of this JSR 349. The implementation itself as |
| 23 |
well as the Bean Validation API and TCK are all provided and distributed under the |
| 24 |
http://www.apache.org/licenses/LICENSE-2.0[Apache Software License 2.0]. |
| 25 |
|