0 Replies Latest reply on Apr 2, 2015 5:40 AM by zsmszsms

    How to audit @Modifying @Query of spring-data-jpa by hibernate envers

    zsmszsms

      @Modifying(clearAutomatically = true) // spring-data-jpa

      @Query("update TravelArticle f set f.praiseTimes = ? where f.id = ?")

      public int incPraiseCounter(final long counter, final long id);

      .......

       

      @Entity

      @Audited //Hibernate envers

      public class TravelArticle

      {

      ......

      }

       

      I hope to audit TravelArticle when I call method incPraiseCounter, but failed. I looked through the source code, and found entity could not been audited when query.createCreateQuery(...).executeUpdate() was called. how it happened, is there a workaround solution in this situation?

       

      Waiting for the reply, thank you in advance.