implement JPA constraint checking