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: logging sql per session
PostPosted: Mon Jul 24, 2006 3:17 pm 
Beginner
Beginner

Joined: Sat Nov 13, 2004 7:21 pm
Posts: 24
Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp

Hibernate version: 2.1

Mapping documents:

Code between sessionFactory.openSession() and session.close():

Full stack trace of any exception that occurs:

Name and version of the database you are using: SQL Server

The generated SQL (show_sql=true):

Debug level Hibernate log excerpt:

Hi

Is there a way to log sql executed with a specified session, or at least to get last 20 executed sql statements with a session before close it?

tanks,


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jul 24, 2006 3:26 pm 
Expert
Expert

Joined: Fri Aug 19, 2005 2:11 pm
Posts: 628
Location: Cincinnati
configure log4j to debug

in your hibernate config file, set

Code:
hibernate.show_sql = true

_________________
Chris

If you were at work doing this voluntarily, imagine what you'd want to see to answer a question.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jul 24, 2006 3:44 pm 
Beginner
Beginner

Joined: Sat Nov 13, 2004 7:21 pm
Posts: 24
I know:
Code:
hibernate.show_sql = true

shows all sql statements, what I need is to see which sql is executet on which session.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jul 24, 2006 5:01 pm 
Beginner
Beginner

Joined: Sat Nov 13, 2004 7:21 pm
Posts: 24
What about this?
org.hibernate.pretty Log the state of all entities (max 20 entities) associated with the session at flush time
can this help me? how I use it?


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.