Hi,
Is there a way/technique to log/get the class that executes a query (the class that contains the sessionfactory)?
For example, given :
Code:
class MyClass {
 method1() {
      MyObject o; 
      ................
      sessionFactory.getCurrentSession().save(o);
 }
method2() {
      ................
      Query query =  sessionFactory.getCurrentSession().createQuery("FROM MyObject....");
      query.list(); 
 }
} 
What I want is to be able to produce a log like this:
Code:
-    MyClass.java:20  insert into my_object values .......
-    MyClass.java:50  select from my_object ........
Any hint ?   maybe  with log4j? or with an interceptor? (suppose there is no access to the source code of MyClass)
Thanks!