[hibernate-dev] [HV] Ability to apply constraint on elements of an Iterable instance
Hardy Ferentschik
hibernate at ferentschik.de
Mon Mar 15 12:21:16 EDT 2010
Hi there,
Emmanuel and I had a discussion regarding a use case given in
http://opensource.atlassian.com/projects/hibernate/browse/HV-264
What if you have a list of strings and want to make sure that each string
is a valid email. Something like this (@Valid is
not helping here either):
@Email
List<String> emails ;
Initially I thought the problem could be quite easily solved by a custom
ConstraintValidator<Email, Iterable<String>>, but as it turns out there
are issues with generating the right property
path for invalid emails using the current ConstraintValidatorContext API.
Besides a custom ConstraintValidator would only be a specific solution for
a general problem. Hence, Emmanuel and I
discussed some solutions and summarized them on
http://opensource.atlassian.com/projects/hibernate/browse/BVAL-202 and
http://opensource.atlassian.com/projects/hibernate/browse/HV-296
It would be great to get some feedback.
--Hardy
More information about the hibernate-dev
mailing list