Uploaded image for project: 'Hibernate ORM'
  1. HHH-10318

Envers: Missing support of CriteriaDelete and CriteriaUpdate

    Details

    • Type: Improvement
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects versions: 5.0.4
    • Fix versions: None
    • Labels:
      None
    • Environment:
      hibernate-entitymanager: 5.0.4.Final
      hibernate-envers: 5.0.4.Final
      PostgreSQL: 9.2
    • Last commented by a user?:
      true
    • Sprint:

      Description

      I am using Hibernate Envers in my project along with a lot of CriteriaDelete and CriteriaUpdate queries.

      The problem now is, that with CriteriaDelete and CriteriaUpdate the auditing does not work properly! That makes using an auditing tool worthless.

      Example:

      @Audited
      public class A {
        //...
        @Basic
        private String myString;
      }
      
      public class AManager {
        // ...
        @Transactional
        public void deleteByMyString(String myString) {
          CriteriaBuilder cb = getEntityManager().getCriteriaBuilder();
          CriteriaDelete<A> query = cb.createCriteriaDelete(A.class);
          Root<A> root = query.from(A.class);
          getEntityManager().createQuery(query.where(cb.equal(root.get("myString"), myString))).executeUpdate();
        }
      }
      

      After executing aManager.deleteByMyString("xyz") which deletes at least 1 row, no A_AUD entry with revtype=2 is created.

        Attachments

          Activity

            People

            • Votes:
              2 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

              • Created:
                Updated: