How to validate model with eclipselink jpa

I hava a model, and i need to validate model with eclipselink jpa
and i add anotation @NotEmpty validate name if empty, but when i save/persist model, validate not work

    public class Role {

        private String id;
        private String name;

        public String getId() {
            return id;

        public void setId(String id) {
   = id;

        public String getName() {
            return name;

        public void setName(String name) {
   = name;


my jpa configuration xml like this

<?xml version="1.0" encoding="UTF-8"?>

<persistence version="2.0" xmlns=""

    <persistence-unit name="Eclipselink_JPA" transaction-type="RESOURCE_LOCAL">


            <property name="javax.persistence.jdbc.url" value="jdbc:mysql://localhost:3306/test"/>
            <property name="javax.persistence.jdbc.user" value="root"/>
            <property name="javax.persistence.jdbc.password" value=""/>
            <property name="javax.persistence.jdbc.driver" value="com.mysql.jdbc.Driver"/>


The JPA API (which EclipseLink implements) is nothing to do with the Bean Validation API.
To utilise the Bean Validation API you need the Bean Validation API jar (javax.validation), together with an implementation of that API (Apache BVAL, Hibernate Validator, etc) in your CLASSPATH.
The only thing JPA provides is to auto-enable validation as per this link, but the default is “auto” so nothing required really for that