-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 
Author Message
 Post subject: how to get all sql queries fired in Hibernate application
PostPosted: Sat Apr 04, 2009 9:55 am 
Newbie

Joined: Thu Mar 05, 2009 2:50 am
Posts: 14
How can i get all the SQL Queries that are fired in the application and from which Class in the application fired that SQL query. I have a problem while using update in Hibernate in Threads i am getting my data updated famtomly

thanks and regards
ramakanth

_________________
Thanks and Regards


Top
 Profile  
 
 Post subject:
PostPosted: Mon Apr 06, 2009 3:58 am 
Regular
Regular

Joined: Sun Aug 01, 2004 6:49 pm
Posts: 76
1. <property name="show_sql">false</property> this is a setting in a xml mapping configuration.
2. Log and see the queries arriving in your dbms.
3. Get the source code of hibernate and step into execution via a debugger.
4. Turn on tracing logging of hibernate.

HTH
Thomas

PS: 3. is highly recommend for all Hibernate users. It is worth it.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Apr 06, 2009 1:45 pm 
Newbie

Joined: Wed Jan 28, 2009 9:57 am
Posts: 16
Location: Leinfelden, Germany
Alternatively, if you want to check this query in your application, you could:
1. Extend the EmptyInterceptor class and override the
Code:
String onPrepareStatement(String sql)
method.
2. Register this SessionInterceptor with your SessionFactory.
3. The sql String in the intercepted onPrepareStatement() method is the query you need.

Note that only the operations performed using the Session interface can be intercepted and not HQL or SQL queries.

Hope this helps.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.