0
votes

is there possibility to set Hibernate Envers so that when ever I delete original entity all revisions of it are deleted also? I need to track the history only when the original entity exists.

1

1 Answers

0
votes

I don't think Envers itself offers such an option, so you have to do stuff yourself.

Options that come to mind:

  • a database trigger on either the entity or the related Envers table, that deletes the history on a delete of the entity or on the insert of a delete change.
  • a JPA listener. Note that a JPA listener is very limited on the action it may perform, but issuing a SQL statement via JdbcTemplate should be fine.