-->
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: LIMIT with HQL or Criteria in nHibernate
PostPosted: Tue Feb 12, 2008 5:53 am 
Newbie

Joined: Sun Jan 13, 2008 10:25 am
Posts: 7
Hello,

it is possible so set a "LIMIT" like the SQL Limit keyword?

I will get all results like SQL "Limit 0,30" or "Limit 30, 35" to build a paging.

At time I use expressions to let build my object result and I did not find anything about a Limit. Further I found the setMaxResult-Method but this is not exactly what I need ;).

I hope you know what I mean and can help me.

greetz
Maurice


Top
 Profile  
 
 Post subject: LIMIT with HQL or Criteria in nHibernate
PostPosted: Tue Feb 12, 2008 9:30 am 
Senior
Senior

Joined: Thu Jun 21, 2007 8:03 am
Posts: 127
Location: UK
Hi Maurice,

I think you should be able to get the same behaviour from SetFirstResults and SetMaxResults as you would from LIMIT.

I believe that LIMIT 30, 35 (which I think in MySQL is records 30->65) would be expressed as:
Code:
...
.SetFirstResult(30)
.SetMaxResults(35)
...


Regards,
Richard


Top
 Profile  
 
 Post subject:
PostPosted: Tue Feb 12, 2008 11:10 am 
Newbie

Joined: Sun Jan 13, 2008 10:25 am
Posts: 7
Thank you Richard,

this is exactly what I need ;).

greetz Maurice


Top
 Profile  
 
 Post subject: Re: LIMIT with HQL or Criteria in nHibernate
PostPosted: Thu Jun 03, 2010 8:55 am 
Newbie

Joined: Tue Jun 01, 2010 11:09 am
Posts: 3
How can i do the same for Update?


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:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.