Win a copy of Testing JavaScript Applications this week in the HTML Pages with CSS and JavaScript forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
  • Piet Souris
  • Frits Walraven
  • Carey Brown

Hibernate CRUD Audit

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
Ranch Hand
Posts: 580
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I would try doing an Interceptor.
    Bookmark Topic Watch Topic
  • New Topic