-->
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.  [ 8 posts ] 
Author Message
 Post subject: Hibernate and SQL Requests
PostPosted: Fri Sep 30, 2005 6:17 am 
Regular
Regular

Joined: Fri Sep 30, 2005 6:15 am
Posts: 50
Hello,

I'm new to hibernate and before to test it I have some questions about
technical features :

1 - What I know is that Hibernate is caching data but what happen if I
update a data from SQL directly or by another application? Hibernate is not
up to date anymore?

2 - Is it possible to trace all the request (in SQL format) that Hibernate
send to the databases (with the date and hour would be nice)

Thanks for your help!


Top
 Profile  
 
 Post subject:
PostPosted: Fri Sep 30, 2005 9:15 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
1 - If you want to learn: read the docs ;)
If you just want to think you know then: of course if data is changed
in the database then hibernates data will be out of date - that is also
the case for any other jdbc access - and sometimes that is even what you want. But please go read the documentation about transaction isolation and session identity; there are naturally mechanism for
ensuring you have the data you want/need.

2 - enable sql logging and configure your underlying logging system.
Again its in the docs.

/max

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Thu Oct 06, 2005 10:24 am 
Regular
Regular

Joined: Fri Sep 30, 2005 6:15 am
Posts: 50
Hello,

Thanks for reply max.
Maybe I was not clear, but I can see SQL on stdout but I can't see the columns values. I have the character '?' instead...

Is it possible to see the complete SQL request run against the database and not those '?'

Thanks for help!


Top
 Profile  
 
 Post subject:
PostPosted: Thu Oct 06, 2005 1:21 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
Its in the FAQ

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Fri Oct 07, 2005 4:44 am 
Regular
Regular

Joined: Fri Sep 30, 2005 6:15 am
Posts: 50
Thanks Max,

maybe I'm a littlbe bit stupid but I can't find the answer to my question in the FAQ...could you please send me the link as it seems you have the answer...

Thanks for help


Top
 Profile  
 
 Post subject:
PostPosted: Fri Oct 07, 2005 5:05 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
http://www.hibernate.org/hib_docs/v3/re ... on-logging

sorry - not in faq, but the obvious place in the docs

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Fri Oct 07, 2005 5:16 am 
Regular
Regular

Joined: Fri Sep 30, 2005 6:15 am
Posts: 50
Ok thanks!

For users with same questions I didn't managed to see the complete SQL statement but I got the prepared statement with its JDBC parameters.

Just ensures that you have those properties set as shown below in your log4j.properties :

log4j.logger.org.hibernate.SQL=debug
log4j.logger.org.hibernate.type=debug

MAX : do you think there is a better solution where I can get the full SQL statement executed on the database directly?

Thanks for help


Top
 Profile  
 
 Post subject:
PostPosted: Fri Oct 07, 2005 5:46 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
use p6spy or similar.

but it will never be precisly the same since embedded constants in sql is not always the same as parameter based queries (escaping and other things)

_________________
Max
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.  [ 8 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.