Package com.avaje.ebean.validation

Annotations for validating entity beans.

See:
          Description

Annotation Types Summary
AssertFalse Validation that can be placed on a method to assert it is true.
AssertTrue Validation that can be placed on a method to assert it is false.
Email Validate property as email address.
Future Validate a Date, Timestamp or Calendar property as having to be in the future.
Length Validate the length of a String property.
NotEmpty Validate property as not null and not an empty string.
NotNull Validate property as not null.
Past Validate a Date, Timestamp or Calendar property as having to be in the past.
Pattern Validate using a Regular expression the pattern of a String property.
Patterns Holder for many Pattern Validation annotations.
Range Validate the numeric range of a property.
ValidatorMeta Marks validation annotations.
 

Package com.avaje.ebean.validation Description

Annotations for validating entity beans.

We will look to migrate over to the standard java bean validation annotations.

You and put these annotations on entity beans and either get Ebean to automatically validate on Ebean.save() or manually validate using Ebean.validate().

It is possibly debatable if validation should be performed by an ORM rather than at a higher level in your application.

Even if you choose not to use these validation annotations the validation framework is in place and if you wish Ebean can automatically read the maximum lengths of all varchar columns (and not nullable constraints) from the database meta data. This is useful when using JDBC batching where the error reporting can be rather obscure (as the error could occur on any data in the batch).

   ## turn on automatic validation for Ebean.save()
   ebean.validation=true
  
   ## turn on automatic creation of not null validation
   ## and max length validation for varchar's based on 
   ## database meta data (no annotations required)
   ebean.validation.autocreate=true
   
   ## for more specific control... 
   ## 
   ## ebean.validation.autocreate.notnull=true
   ## ebean.validation.autocreate.length=true
   ## ebean.validation.autocreate.length.max=4000
   ## NB: Only auto create length validation for
   ## varchar columns less than 4000 characters
 



Copyright © 2010. All Rights Reserved.