-->
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.  [ 7 posts ] 
Author Message
 Post subject: fetching query text
PostPosted: Fri Dec 02, 2005 2:36 pm 
hello

another question. is there a way to fetch a text
of command that result in exception ?
normally i get adoexception ora hibernateexception.
im in this kind of situation that i should have text of the query
when something fails :/

regards
lukasz


Top
  
 
 Post subject:
PostPosted: Fri Dec 02, 2005 4:18 pm 
Contributor
Contributor

Joined: Thu May 12, 2005 8:45 am
Posts: 226
Have you enabled the log4net logging support? http://wiki.nhibernate.org/display/NH/Configuring+log4net+Logging


Top
 Profile  
 
 Post subject:
PostPosted: Sat Dec 03, 2005 6:21 am 
i configured App.config according to example, but when i fire
log4net.Config.XmlConfigurator.Configure(); i get
log4net:ERROR XmlConfigurator: Failed to find configuration section 'log4net' in the application's .config file. Check your .config file for the <log4net> and <configSections> elements. The configuration section should look like: <section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler,log4net" />
at the output console.

my second question is: will log help me to obtain sql query text?
should it be used with show_sql set to true ?

can you explain it to me ? : )
regards
roman


Top
  
 
 Post subject:
PostPosted: Sun Dec 04, 2005 3:09 am 
Contributor
Contributor

Joined: Thu May 12, 2005 8:45 am
Posts: 226
Yes, the SQL should be in the log. I believe this will show the SQL without cluttering up the log file:
Code:
<logger name="NHibernate">
   <level value="ERROR" />
</logger>
<logger name="NHibernate.Loader.Loader">
   <level value="INFO" />
</logger>


Top
 Profile  
 
 Post subject:
PostPosted: Sun Dec 04, 2005 1:59 pm 
but the problem is that i need this query inside my program.
during execution i should be able to fetch sql text in case
of exception, and pass it somewhere.


Top
  
 
 Post subject:
PostPosted: Sun Dec 04, 2005 4:02 pm 
i could possibly write my own appender and use it for NHibernate.SQL
logs. then i will get queries but without parameter values.
is there any more simple way to get query text ?
regards
lukasz


Top
  
 
 Post subject:
PostPosted: Mon Dec 05, 2005 10:35 am 
Contributor
Contributor

Joined: Thu May 12, 2005 9:45 am
Posts: 593
Location: nhibernate.org
You may give a look at how NHibernate Query Analyzer works...

_________________
Pierre Henri Kuaté.
Get NHibernate in Action Now!


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