Jun 28, 2017

How to emulate database triggers at the application level

Frameworks such as Hibernate Envers can emulate database triggers at the application level.

The advantage is that you don't need to mind the database-specific syntax for triggers since events are captured anyway by the Persistence Context.

The disadvantage is you can't log data change events that don't flow through the application (e.g. changes coming from a database console or from other systems that share the same RDBMS).