• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Hibernate CRUD Audit

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 580
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I would try doing an Interceptor.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic