1

In Hibernate Envers it is possible to have a separate audit table. Similarly, is it possible to log into tables other than the entity’s table using Spring Data JPA auditing?

Jens Schauder
  • 77,657
  • 34
  • 181
  • 348
Rahul Singh
  • 107
  • 1
  • 8
  • It's clear exactly what you're asking. Envers places all audit history in separate tables from the base entity table, so that's by default. I'm not exactly sure what you're asking. – Naros Oct 29 '18 at 13:50
  • Maybe this can be of use: https://spring.io/projects/spring-data-envers – 0xR Apr 19 '19 at 08:29

1 Answers1

1

The auditing feature of Spring Data JPA just fills attributes in the entity you are persisting. How and where these attributes get persisted is controlled by you JPA implementation and of course your database.

JPA offers @SecondaryTable to map fields to a second table.

If this isn't flexible enough for you, you can always employ database tools to achieve the effect by mapping the entity to a view which via triggers distributes the data however you want.

Jens Schauder
  • 77,657
  • 34
  • 181
  • 348