Injecting JPA's Entity Manager in Hibernate's EmptyInterceptor

后端 未结 2 1798
误落风尘
误落风尘 2021-02-14 19:51

I am using JPA-2.0 with Hibernate in my data access layer.

For audit logging purposes, I am using Hibernate\'s EmptyInterceptor by configuring below property in persiste

2条回答
  •  不知归路
    2021-02-14 20:53

    I am considering persistenceManager initiated successfully in your Abstract class. You may Have a class AuditLogDAO which extends your AbstractDao. Inject AuditLogDAO class into your interceptor and call auditLogDAO.save(entity); and other methods.

    Or write a Util class which perform DB operations and inject the util class to your interceptor.

提交回复
热议问题