-->
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.  [ 3 posts ] 
Author Message
 Post subject: how to read Sql Query from nhibernate?
PostPosted: Mon Jun 04, 2007 12:39 am 
Newbie

Joined: Fri Jun 01, 2007 2:22 am
Posts: 3
Location: India
I want to read sql query from nhibernate.
i'm using Icriteria ("criteria.List<IEntity>();") to get Data from a table.

how will i get sql query that nhibernate generates ?
how will i get insert, update and delete SQL statement from nhibernate?

Thanks in advance..


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jun 04, 2007 3:58 pm 
Newbie

Joined: Fri May 18, 2007 1:41 pm
Posts: 8
Set "hibernate.show_sql" to "true" in your configuration properties e.g.
Code:
   <nhibernate>
      <add
         key="hibernate.show_sql"
         value="true" />

or configure log4net to show "Debug" level warnings for the NHibernate.SQL logger.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jun 07, 2007 1:14 am 
Newbie

Joined: Fri Jun 01, 2007 2:22 am
Posts: 3
Location: India
Thanks for ur reply.

Yes i've done this


<nhibernate>
<add
key="hibernate.show_sql"
value="true" />


but i'm using following code


ICriteria criteria=m_session.CreateCriteria(type);
dataSource = criteria.List<IEntity>();


for save:
tx = m_session.BeginTransaction();
m_session.Save(item);
tx.Commit();



i'm getting the data from this but i want to use sqlquery after this code.
i want to save geenrated sql query in database also.
so how will i get sqlquery in a string?

Thanks..!


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