views:

559

answers:

2

I'm adding envers to an existing hibernate entities. Everything is working smoothly so far as far as auditing, however querying is a different issue because the revision tables aren’t populated with the existing data. Has anyone else already solved this issue? Maybe you’ve found some way to populate the revision tables with the existing table? Just thought I’d ask, I'm sure others would find it useful.

A: 

Wouldn't you just add an initial record via an upgrade SQL when rolling out the change?

Pat
+1  A: 

Take a look at http://www.jboss.org/files/envers/docs/index.html#revisionlog

Basically you can define your own 'revision type' using @RevisionEntity annotation, and then implement a RevisionListener interface to insert your additional audit data, like current user and high level operation. Usually those are pulled from ThreadLocal context.

Gregory Mostizky