-->
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.  [ 1 post ] 
Author Message
 Post subject: Select most recent object
PostPosted: Wed May 05, 2004 12:43 pm 
Newbie

Joined: Wed May 05, 2004 12:35 pm
Posts: 1
I have a hibernate object heirarchy in a table named "entry". All entries have a dateCreated field. I would like to select entries based on several parameters, one of which is that the entry should be the most recent of those that match the rest of the parameters.

The best I've been able to do is get a dateCreated-ordered list of the entries like this:

session.find("from Score as score where score.gradeRecord = ? order by score.dateCreated desc", gradeRecord, Hibernate.entity(GradeRecord.class));

and return the first member of the list. This is an inefficient solution, and I'm looking for a better one. Any ideas?

Thanks!
Josh


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

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.