Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > Hibernate query object SQL output

Reply
Thread Tools

Hibernate query object SQL output

 
 
bb
Guest
Posts: n/a
 
      07-21-2005
Hi,
My team is using Hibernate. We are trying to get the Hibernate query
object to output pure SQL, not stuff like the following:

update T_CONTROL set id=?, max_order_number=?, max_requisition_number=?

where row_id=?

insert into T_CREDIT (id, vendor_id, amount, update_user,
update_timestamp, status, note, reason, date_paid, isas_id)
values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)

In other words, get rid of the question marks and insert the ACTUAL
values that are being used. This would make debugging SQL errors a lot
easier.

I'm sure other's have a similar problem. Any help would be greatly
appreciated.

 
Reply With Quote
 
 
 
 
xlukasx@poczta.onet.pl
Guest
Posts: n/a
 
      07-21-2005
I don't know what you mean ... but you can change log level in log4j:
log4j.logger.org.hibernate.type=debug
This didn't replace question mark but you will be able to see values.

Greetings
luc

 
Reply With Quote
 
 
 
 
Rico
Guest
Posts: n/a
 
      07-22-2005
On Thu, 21 Jul 2005 10:28:43 -0700, bb wrote:
> Hi,
> My team is using Hibernate. We are trying to get the Hibernate query
> object to output pure SQL, not stuff like the following:
>
> update T_CONTROL set id=?, max_order_number=?, max_requisition_number=?
>
> where row_id=?
>
> insert into T_CREDIT (id, vendor_id, amount, update_user,
> update_timestamp, status, note, reason, date_paid, isas_id)
> values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
>
> In other words, get rid of the question marks and insert the ACTUAL
> values that are being used. This would make debugging SQL errors a lot
> easier.
>
> I'm sure other's have a similar problem. Any help would be greatly
> appreciated.


humm... as luc mentioned, you can see the values being bound to the
parameters by adjusting the debug level.

for my part, I'd say that if I wanted to be debugging SQL errors, I
wouldn't be using Hibernate.

Rico.
 
Reply With Quote
 
Hemal Pandya
Guest
Posts: n/a
 
      07-22-2005


bb wrote:
> In other words, get rid of the question marks and insert the ACTUAL
> values that are being used. This would make debugging SQL errors a lot
> easier.
>


Look for p6spy which provides a jdbc driver that logs the SQL
statements being executed. I found it very useful. While looking for
information on p6spy I just came across
http://www.informit.com/articles/art...?p=353736&rl=1 which you
may find relevant.

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to get SQL query string when using Hibernate? ZelluX Java 1 06-07-2008 07:12 PM
Hibernate cannot find hibernate.cfg.xml jstorta Java 1 01-19-2008 01:45 PM
Build dynamic sql query for JSTL <sql:query> Anonymous Java 0 10-13-2005 10:01 PM
Hibernate Syncronizer now generates code for Hibernate 3.0 msenin@covad.net Java 0 07-14-2005 05:47 AM
[HIBERNATE] [EVALUATION] - Gavin King Censors Hibernate Forum Ilias Lazaridis Java 0 12-27-2004 04:26 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57