-->
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: How to filter max time record using session.filter?
PostPosted: Sat Jan 08, 2005 10:54 am 
Senior
Senior

Joined: Wed Dec 17, 2003 4:24 am
Posts: 188
Hi everyone:

I have a article Set ,and I want to get the last post article from this articles. I use the following code:
Code:
Article lastPost=(Article)session.filter(article.getArticleSet(),"this.articleTime=max(articleTime)");


But it can't work. If session.filter can do this, how to write it? Thks[/code]

_________________
You are not alone...


Top
 Profile  
 
 Post subject: :(
PostPosted: Sun Jan 09, 2005 10:53 pm 
Senior
Senior

Joined: Wed Dec 17, 2003 4:24 am
Posts: 188
Now I do it use this method:
Code:
String userid=user.getUserid();
List articles=session.find("from Article a ,User u where a.user.userid="+userid+" order by articleTime asc" ); <--order by time

Article article=(Article)articles.get(0); <--- order by time will get last post



But it is not convinent. What 's the best method to do this if I use session Filter? Thks[/code]

_________________
You are not alone...


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.