-->
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.  [ 2 posts ] 
Author Message
 Post subject: HQL: How to fetch only the last record ?
PostPosted: Tue Jan 22, 2008 10:00 am 
Newbie

Joined: Tue Jan 22, 2008 9:53 am
Posts: 18
Hello All,

Does anybody know how to fetch, using an elegant query, only the last record or better yet: only the x last records ?

Thanks in advance for the attention


TH


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jan 22, 2008 4:04 pm 
Expert
Expert

Joined: Mon Nov 26, 2007 2:29 pm
Posts: 443
Create a criteria query, add to it an Order DESC, and set maxRows to x.

_________________
Gonzalo Díaz


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