I think this might possibly be answered elsewhere, but was getting lost in the context of other posts. So, decided to restate here. If anyone knows of this being already answered elsewhere, please point me in that direction. So, my questions.
- I see JSR-303, JSR-349 and Hibernate Validator. What is the difference?
- It seems to me that Hibernate Validator is a reference implementation of the JSR-303 spec, is that true?
- Then what is 349?
- If Hibernate Validator is a reference impl of the spec, are there other impl's of the spec?
Now some specifics of what I am looking for. I have done some reading about JSR-303 and I follow generally how the annotations work. My question is can I dynamically change the constraint values? Take the following for example:
public class Foo { @Min(value = 18, message = "Age must be greater than or equal to 18") @Max(value = 150, message = "Age must be less than or equal to 150") int fooAge; }
So, is there a way using the spec to feed the age constraints at runtime. So, lets say for some reason in one case I need the min to be 20 and max to be 100. In another case I need 10 and 50, etc. etc.
Thanks in advance for helping to clear this up for me.
303 is the JSR for Bean Validation 1.0. 349 is the JSR for Bean Validation 1.1.
The home page of the project says: "Hibernate Validator 5.x is the reference implementation Bean Validation 1.1!"
The JSR defines the specification. Hibernate validator is the reference implementation of this specification.
It seems not: http://beanvalidation.org/1.1/certified/
Yes, you can do that by assigning the constraints to validation groups, and activate one group or another depending on the use-case. See http://beanvalidation.org/1.0/spec/#validationapi-validatorapi-groups