integer « Validation « JPA Q&A





1. how to validate integers or Long values,so that it should accept only numbers not characters using annotations in Hibernate?    stackoverflow.com

I have a Command Class as below

public class DistrictCommand {
private Integer districtId;
@NotBlank
private String code;
@NotBlank
@RegExp("^[A-Za-z]*[A-Za-z]$")
private String name;
@NotBlank
private String stateName;
@NotNull
private Long pincode;
} Here i want to validate the pincode,if i leave the pincode field ...