[hibernate-dev] null values in validation

Federico Mancini mancini_federico at yahoo.it
Thu Oct 14 14:06:54 EDT 2010


  Hi,
  we managed to implement a first version of boolean composition for the 
validator, and it seems to require very few changes to the code.
We also opened an issue on Jira about that.
 From the tests we ran, the constraints seem to be evaluated correctly, 
but we have some strange behaviour regarding the reporting of  
violations, which we are investigating.
Reporting violations would also be an interesting subject of discussion 
in itself, since we cannot say anymore that a composed constraint fails 
if just one of the constraint
composing it fails. We have to evaluate all the tree of constraints 
before knowing the final outcome (if it is a disjunction for example).
In this case we thought it might be best to report everything as a 
single violation by default.

Another thing we wondered about is the default behaviour of  built-in 
constraints when they validate null values. Are they supposed to succeed 
on null values by default?
In other words, do we assume that unless the user specifies @NotNull, it 
means that a null value is valid and should not generate an exception 
for other constraints?

Federico




More information about the hibernate-dev mailing list