title: "who_called_me" equivalent for Hibernate
body: <p>We know that it is possible to dynamically figure out the name of the procedure or package that is currently executing as explained <a href="http://tkyte.blogspot.co.uk/2009/10/httpasktomoraclecomtkytewhocalledme.html" rel="nofollow noreferrer">here</a> and <a href="https://stackoverflow.com/questions/14554891/capturing-package-procedure-function-name-from-a-trigger">here</a>. This generally applies to statements being executed from other stored procedures (compiled) in the database. </p>
  
  <p><strong>The problem:</strong></p>
  
  <p>We have been trying to log all <code>UPDATE</code> activity on a specific column (called <code>STATE</code>) by placing a trigger on the table and invoking <code>who_called_me</code> from within the trigger. The purpose of doing this is apparently as per the application design the column <code>STATE</code> could get updated by multiple pieces of code (residing in the database) based on certain business conditions. In addition to that, the column could also get updated by the application which is a hibernate based application and at times when the update happens by a hibernate query the <code>who_called_me</code> function returns nothing. There are multiple parts in the application that could also <code>UPDATE</code> the column <code>STATE</code> based on certain conditions. </p>
  
  <p>The <code>who_called_me</code> strategy is working well for us in cases where a stored procedure (which resides in the database) issues the <code>UPDATE</code> statement and <code>who_called_me</code> is successfully capturing the corresponding <em>owner, name, line no.</em> etc. of the stored procedure. But in case the <code>UPDATE</code> happens from hibernate, the function captures no details. </p>
  
  <p>Is there a way to capture which hibernate query <code>UPDATE</code>d the row through the trigger? Or is there any other way?</p>
  
  <p>Note: The trigger code is similar to the answer posted on <a href="https://stackoverflow.com/questions/14554891/capturing-package-procedure-function-name-from-a-trigger">this</a> question.</p>