-->
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: Fetch Last Row of a table
PostPosted: Wed Apr 12, 2006 12:44 pm 
Newbie

Joined: Mon Mar 13, 2006 2:29 pm
Posts: 1
Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp

Hibernate version:3.1.2

What is the equivalent HQL for the following mysql query for fetching last row of a table?

SELECT * FROM tbluser order BY iuserid DESC LIMIT 1


Top
 Profile  
 
 Post subject:
PostPosted: Wed Apr 12, 2006 1:13 pm 
Regular
Regular

Joined: Wed Aug 25, 2004 6:23 am
Posts: 91
You can apply the sort in the HQL and then use query.setMaxResults(1); to limit to 1 result.


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.