vendredi 5 juin 2015

criteria query 'delete' shows error

I am trying to do a delete using criteria query. But it seems fine but shows error during runtime. I get an error as seen below:

Caused by: java.lang.AbstractMethodError: org.hibernate.ejb.criteria.CriteriaBuilderImpl.createCriteriaDelete(Ljava/lang/Class;)Ljavax/persistence/criteria/CriteriaDelete;

My code is given below.

CriteriaBuilder cb = faqentityManager.getCriteriaBuilder();
              CriteriaDelete<Wr3HanbaiChik> delete = cb.createCriteriaDelete(Wr3HanbaiChik.class);
              Root e = delete.from(Wr3HanbaiChik.class);
              delete.where(cb.equal((e.get("fkenCd")), 2));
              faqentityManager.createQuery(delete).executeUpdate();

The same entity manager is working for criteria query select. So the problem is not in the entity manager. Also the error is shown only on

CriteriaDelete delete = cb.createCriteriaDelete(Wr3HanbaiChik.class);

Aucun commentaire:

Enregistrer un commentaire