-->
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.  [ 2 posts ] 
Author Message
 Post subject: How to configure Hibernate to log SQL statement with value
PostPosted: Thu Apr 19, 2007 11:06 pm 
Newbie

Joined: Tue Jul 11, 2006 10:41 pm
Posts: 11
Hi ,

i was wondering if there is any way in hibernate to cofingure so all SQL statement will be log with value


Below are something i get when i do searching using Criteria

/* criteria query */ select
this_.MENU_ID as MENU1_5_0_,
this_.PARENT_ID as PARENT2_5_0_,
this_.LOCALE as LOCALE5_0_,
this_.MENU_NAME as MENU4_5_0_,
this_.MENU_TYPE as MENU5_5_0_,
this_.PAGE_URL as PAGE6_5_0_
from
SWIM.SWIM.MENU_CONFIGURATION this_
where
this_.PARENT_ID=?
and this_.MENU_TYPE=?
order by
this_.MENU_ID asc



But as you can see Parent_id and menu_type = ?
Seems like preparedStatement to me.
How can i see full SQL statement so it would be easier to just copy and paste the SQL to my Database Query Editor to run the query


Thanks


Top
 Profile  
 
 Post subject:
PostPosted: Fri Apr 20, 2007 12:44 am 
Regular
Regular

Joined: Mon Mar 26, 2007 12:38 am
Posts: 119
Hi,
If I understand it correctly, the operations that take place are, ( done by Hibernate )
i) set the values into host bind variables.
ii) fire the query as-is with bind variables to underlying database.

A query of the form "select * from my_table where my_name = 'name'" is never formed. ( assume 'name' is the bind value )

So, we might not ( my guess and understanding ) get a query that can be directly fired at prompt.

However, to know the values of bind variables, you can use,
log4j.logger.org.hibernate.type=debug


------------------------------------------------------------------
Rate the reply if you find it helpful


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