-->
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 use TOP Clause
PostPosted: Tue Jan 31, 2006 4:58 am 
Newbie

Joined: Thu Dec 01, 2005 11:22 am
Posts: 2
Location: IN
How to get TOP N rows from SQL Server with NHibernate

_________________
Salim.


Top
 Profile  
 
 Post subject: use Query
PostPosted: Tue Jan 31, 2006 6:17 am 
Regular
Regular

Joined: Tue Jan 03, 2006 7:21 am
Posts: 85
use
IQuery query = sess.CreateQueyr("hql goes here");
query.SetFirstResult(0);
query.SetMaxResults(20);
IList lst = query.List()

This should return the TOP 20 items


Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 01, 2006 12:42 am 
Regular
Regular

Joined: Mon May 16, 2005 1:35 am
Posts: 67
Or you can use method chaining:

IList lst = sess.CreateQuery("hql goes here").SetFirstResult(0).SetMaxResults(20).List();


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.