开发者

Auditing with Spring Data JPA

开发者 https://www.devze.com 2023-03-23 15:35 出处:网络
I am using Spring Data JPA in an application in which all entity objects need auditing.I know that I can have each either implement Auditable or extend AbstractAu开发者_开发技巧ditable, but my problem

I am using Spring Data JPA in an application in which all entity objects need auditing. I know that I can have each either implement Auditable or extend AbstractAu开发者_开发技巧ditable, but my problem is coming with the overall auditing implementation.

The example on the Spring Data JPA reference pages seems to indicate that you need an AuditableAware bean for each entity. Is there any way to avoid this extra code and handle it in one place or through one configuration?


The generic parameter of AuditorAware is not the entity you want to capture the auditing information for but rather the creating/modifying one. So it will typically be the user currently logged in or the like.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号