1 year ago
#345091

Kapil Arora
Validate 1 field min and max based on another field value using JSR303 Validation
I have 2 fields
Class AgeDTO{
@Min(0)
private int minAge;
@Max(2)
private int maxAge;
private AgeType ageGroup;
}
How to validate minAge and maxAge based on ageGroup values as per below limits?
Age and Group
Age can be 0-2 for the infant group Age can be 2-12 for the youngster group Age can be 13-17 for the teen group Age can be 18-59 for adults
How can I write validation for these 2 field combinations in java?
java
spring-boot
hibernate-validator
0 Answers
Your Answer