1

Due to historic reasons we use envers as well as a custom auditing mechanism. Some tables are audited by envers but one table and most of its dependent tables are audited manually.

Our custom solution creates a copy of the object graph, adds a timestamp and saves the *history objects to the corresponding tables.

Let's say we have an entity A, which references a collection of entities B, which references a collection of entities C. If we detect an update or an insert of A, we create a copy A_History, which references a collection of entities B_History which references a collection of entities C_History. All properties of the referenced entities are copied into the corresponding *history object and the complete graph is persisted. In reality we are dealing with 12 tables to represent the object graph.

To get rid of the old code and to unify the behavior, we'd like to migrate all auditing to envers. But of course we'd like to preserve the already existing history, even though it was not created by envers.

I found some guides to create initial revision information if envers is introduced in an existing project. But I didn't find any help to migrate already existing revision information not managed by envers.

Is there a way to do the migration apart from writing raw sql statements?

samjaf
  • 1,033
  • 1
  • 9
  • 19

1 Answers1

1

There is currently no support for an import type feature to load external audit informational into the Envers audit table structure, so SQL statements would be the only alternative for seeding Envers audit history at the moment.

Naros
  • 19,928
  • 3
  • 41
  • 71