-->
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 see actual SQL generated with query parameter values?
PostPosted: Wed Jan 11, 2006 2:44 pm 
Beginner
Beginner

Joined: Mon Aug 01, 2005 3:10 pm
Posts: 22
Hi,

I have been using hibernate.show_sql=true setting and that shows the SQL queries in a running application but with ?s for the values. I would like to know how to log the SQL statements with actual query parameter values instead of ?s.

Some months ago I believe I saw a thread that mentioned some kind of plugin that enables logging to show actual query parameter values inline with the SQL query. Can someone please point me to that or another way to do the same?

Thanks,
Mrtz


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jan 11, 2006 3:47 pm 
Expert
Expert

Joined: Wed Apr 06, 2005 5:03 pm
Posts: 273
Location: Salt Lake City, Utah, USA
see if this thread helps: http://forum.hibernate.org/viewtopic.php?t=946498&highlight=

_________________
nathan


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jan 11, 2006 4:44 pm 
Beginner
Beginner

Joined: Mon Aug 01, 2005 3:10 pm
Posts: 22
thanks nathan, this was the exact thread i was looking for.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Mar 13, 2006 12:09 pm 
Newbie

Joined: Mon Mar 13, 2006 10:52 am
Posts: 1
Hi,

is there really no other way to see the parameter values other than setting
Code:
log4j.logger.org.hibernate.type = DEBUG


If I do this, my logfile gets really big and difficult to read.

Wouldn't it be wonderful if one could have 1 line in the logfile instead of n+1, where n = number of parameters?

Surely

Code:
update ... , bind parameters [1,1,null, 2342, ..0]


is much, much better than

Code:
update FlightEntry set version=?, companyid=?, entryid=?, flightnumber=?, registrationnumber=?, scheduled_arrival_time=?, scheduled_departure_time=?, weekdays=?, handling_time=?, followup_time=?, fueling_time=?, fuelrequest=?, quantity=?, secondvehicle=?, airplanetype_id=?, airline_id=? where id=? and version=?
[IntegerType] binding '1' to parameter: 1
[LongType] binding '1' to parameter: 2
[LongType] binding null to parameter: 3
[StringType] binding '2342' to parameter: 4
[StringType] binding null to parameter: 5
[TimeType] binding null to parameter: 6
[TimeType] binding null to parameter: 7
[StringType] binding null to parameter: 8
[LongType] binding null to parameter: 9
[LongType] binding null to parameter: 10
[LongType] binding null to parameter: 11
[BooleanType] binding 'false' to parameter: 12
[BigDecimalType] binding null to parameter: 13
[BooleanType] binding 'false' to parameter: 14
[LongType] binding null to parameter: 15
[LongType] binding '2' to parameter: 16
[LongType] binding '1' to parameter: 17
[IntegerType] binding '0' to parameter: 18


Using a pass-through jdbc driver like p6spy just to get logging seems a bit overkill. And p6spy seems to be dying slowly anyway (last change in 2003).



Ana


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:
cron
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.