Spring-Data JPA and Audit updated by @Modifying

Asked

Viewed 361 times

1

It is possible to audit an update operation with Spring-Data Auditing using the update via annotations @Query and @Modifying instead of using the method save()?

1 answer

2


@Query and @Modifying has nothing to do with Audit. They are annotations that inform Spring Data when a method is just a query, or when that method makes modifications such as Insert or update.

To work with Spring audit, use Aspectj to intercept what you want to audit. With this api, you can use annotations like @Before, @After, @AfterReturning, @Around to meet what you need. More information on how to do this you find here more detailed information can be found on the spring reference.

  • Okay, I just wanted to confirm even if I had this possibility or not. Thanks for the reply and the links.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.