-->
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: query
PostPosted: Thu Aug 16, 2007 1:40 pm 
Newbie

Joined: Thu Aug 16, 2007 1:37 pm
Posts: 2
How do I write a query to get the latest 10 items added to a table.

thanks,

ed


Top
 Profile  
 
 Post subject:
PostPosted: Thu Aug 16, 2007 1:42 pm 
Newbie

Joined: Thu Aug 16, 2007 1:37 pm
Posts: 2
New to hibernate, started to use it with eclipse - which generated a bunch of DAO and PoJO classes for me.

I am trying to enhance it with a method - to query the latest/newst 10 items added to a table.

How would I structure such a query.

thanks,


Top
 Profile  
 
 Post subject:
PostPosted: Thu Aug 16, 2007 3:28 pm 
Expert
Expert

Joined: Fri Aug 19, 2005 2:11 pm
Posts: 628
Location: Cincinnati
order it descendingly on whatever attribute you use
max results = 10

_________________
Chris

If you were at work doing this voluntarily, imagine what you'd want to see to answer a question.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Aug 17, 2007 5:14 am 
Newbie

Joined: Thu Aug 16, 2007 11:26 am
Posts: 3
try have a column that has a sysdate of the time and date when that entry was made, and then order by that column


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.