I want to validate the size of an integer using Hibernate. I have been testing different annotations such as @Size, @Length and @Range but I don't seem to be able validate the specific size of an Integer. They seem to work for Strings, but for Integers its fine for a range but not a specific number. I want to ensure my SortCode field is only 6 digits long.
@Column(name = "SortCode", nullable = false)
// @Size(max = 6, min = 6)
// @Length(min = 0, max = 6)
@NotNull(message = ErrorConstants.SORTCODENULL)
//@Range(min = 000000)
private Integer SortCode;