2

Hopefully I can express this in a coherent and meaningful way:

Two of our DBA's came up to me today after an email I sent explaining why we were using NHibernate and the benefits of an ORM framework. They have been pushing hard for refactoring our stored procs to include instrumentation like this:

BEGIN DBMS_APPLICATION_INFO.set_module(module_name => 'Human Resources' ,action_name => 'Get Employees');

{sql here}

DBMS_APPLICATION_INFO.set_module(NULL, NULL);

My questions really stem around how could we accomplish this, are there any huge caveats that would recommend against finding an implementation for this, if this is too painful, are there alternatives.

Thank you in advance, -sean

Sean
  • 129
  • 1
  • 8
  • This is a good start in the absence of any other instrumentation, but it is unclear to me where you are considering the calls - PL/SQL stored procedures or Java-side code? – dpbradley Jul 20 '10 at 00:09
  • That's the problem, the dba's would like the instrumentation to be on the database side but we're not using stored procs, just NHibernate's generated SQL. Can we add the instrumentation to the NHibernate SQL? – Sean Jul 21 '10 at 14:21
  • 1
    Don't know how it fits in with NHibernate (and that's why I'd like to see an example), but the ODP documentation has Module/Action in as Connection properties http://download.oracle.com/docs/html/E15167_01/OracleConnectionClass.htm#i1000208 – Gary Myers Jul 22 '10 at 04:46
  • I can't actually give any examples as I'm trying to figure it out but it would basically be like asking NHibernate to prepend and append calls to DBMS_APPLICATION_INFO.set_module before it does anything with the underlying datastore. – Sean Aug 04 '10 at 18:51

1 Answers1

0

Seems like what you need is auditing? Maybe Data Auditing in NHibernate and SqlServer and http://www.shawnduggan.com/?p=89 can help you out

Community
  • 1
  • 1
Zabba
  • 64,285
  • 47
  • 179
  • 207
  • This is definitely heading in the right direction. The event api in NHibernate might just be what they are asking for. I will post what I find after some more experimentation. Thank you. – Sean Aug 04 '10 at 18:47