• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Hibernate CRUD Audit

 
Nigel Nielsen
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Our application has the following audit strategy: every table has a mirror "history" table with two additional columns - "ID_USER" and "TIMESTAMP". Every INSERT/UPDATE/DELETE operation starts a trigger which inserts a new record in the history table, so that we have a full audit log of who does what when.

The problem is that the trigger does not know who is currently logged in within J2EE. Any recommendations about how to achieve that with Hibernate? Should we try our own impl of hibenate's Interceptor, or should we seek a way to somehow pass transaction-scope variables though JDBC... ? Augmenting the persistent classes with an additional property is not preferable.

Any ideas would be appreciated.

-- Nick
 
James Carman
Ranch Hand
Posts: 580
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I would try doing an Interceptor.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic