I need to implement range constraints on Entity data fields:
@Entity
@Table(name = "T_PAYMENT")
public class Payment extends AbstractEntity {
//....
//Something like that
@Range(minValue = 80, maxValue = 85)
private Long paymentType;
}
I already created validating service, but have to implement many of these cases.
I need the app to throw exception if the inserted number is out of range.
@Max(85) @Min(5)
and if you want define custom messages for this validation then you need to create custom constraints. Refer this link – Tusk