-->
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: Extracting more information from SQL Exception
PostPosted: Thu Jan 21, 2010 9:55 pm 
Newbie

Joined: Thu Jan 21, 2010 9:47 pm
Posts: 3
I am using Hibernate 3.0.5 and Hibernate Transaction manager to manage transaction. When flushing the objects, say Oracle DB didnt accept and JDBC driver throws the exception with message "cannot insert NULL into <some table>".
This is result of an insert query fired.
is there any way to find the object to log the values in the object to trace the problem?


Top
 Profile  
 
 Post subject: Re: Extracting more information from SQL Exception
PostPosted: Fri Jan 22, 2010 3:12 am 
Expert
Expert

Joined: Tue Jun 16, 2009 3:36 am
Posts: 990
Hi,

I personally know following ways to log sql-statements:

log4j.logger.org.hibernate.SQL=TRACE

This logs just the prepared statement SQL (no values, only place holder "?" )
To log Log JDBC bind parameter runtime arguments:

log4j.logger.org.hibernate.type=TRACE

Unfortunately the output is not well formated and rather unreadable.
Personally I prefer to use P6spy (http://www.p6spy.com/) to log my hiberante sql-statements.


Top
 Profile  
 
 Post subject: Re: Extracting more information from SQL Exception
PostPosted: Fri Jan 22, 2010 3:28 pm 
Newbie

Joined: Thu Jan 21, 2010 9:47 pm
Posts: 3
Thanks pb00067.

I will certainly look deeper into this. I went through P6spy on the higher level.
I cant enable trace in PROD servers. I want the details of bean only when an exception happens.
Is there any way to interept that?


Top
 Profile  
 
 Post subject: Re: Extracting more information from SQL Exception
PostPosted: Mon Jan 25, 2010 12:29 pm 
Newbie

Joined: Thu Jan 21, 2010 9:47 pm
Posts: 3
Have anybody tried something like this?


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.