-->
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.  [ 4 posts ] 
Author Message
 Post subject: How to log database specific SQL statements?
PostPosted: Thu Mar 15, 2007 7:50 am 
Newbie

Joined: Thu Mar 15, 2007 7:43 am
Posts: 8
Hi All,

Hibernate 3.1.3 is used with IBM websphere and DB2 database. I am looking for logging the SQL statements which hibernate executes on the db2 database and not the HQL statements with ??? and paramenter values.

Is there a way to print those real SQL statements in the log file?

Thanks in advance

Best Regards,
-Prasad


Top
 Profile  
 
 Post subject:
PostPosted: Thu Mar 15, 2007 9:29 am 
Expert
Expert

Joined: Tue Jul 11, 2006 10:21 am
Posts: 457
Location: Columbus, Ohio
Short answer, no. I would suggest p6spy to do database call interception and logging. You can see the prepared SQL statement if you debug log the org.hibernate.SQL package. You can see the parameter binds if you debug log the org.hibernate.type package. Unfortunately, if you debug the org.hibernate.type package, you will also get a bazillion messages when the entities are hydrated from the result set.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Mar 15, 2007 10:18 am 
Newbie

Joined: Thu Mar 15, 2007 10:11 am
Posts: 19
Location: Dallas
You can add a property hibernate.show_sql=true in the hibernate properties file.

Don't forget to Rate


Top
 Profile  
 
 Post subject:
PostPosted: Thu Mar 15, 2007 10:30 am 
Newbie

Joined: Thu Mar 15, 2007 10:11 am
Posts: 19
Location: Dallas
Increasing the logging level gives you the full binding information of each parameter.

Don't forget to rate.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 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.