Thursday, May 30, 2019

Hibernate Envers: Custom Revision Entity (Part 2)

Introduction

In my previous article, I gave an overview of Hibernate Envers for auditing entities. The main goal of this article is to introduce a custom revision entity with Hibernate Envers.

Basic Concept

In my previous article, I wrote about how to implement auditing with Hibernate Envers. We used two entities: Employee and Department. Hibernate Envers internally creates a default revision entity with an id and tmpstmp column/properties. Now, we are going to add another property, refRevisionId, to this table. That's why we now need another entity, which will be inherited from DefaultRevisionEntity. And to listen to audit data and to add an entry to a custom revision table, we need a listener, which will be inherited from RevisionListener.



from DZone.com Feed http://bit.ly/2KargKZ

No comments:

Post a Comment