-->
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.  [ 3 posts ] 
Author Message
 Post subject: Pagination & DAOs
PostPosted: Sun Dec 18, 2005 8:07 pm 
Newbie

Joined: Tue Jan 25, 2005 5:05 pm
Posts: 17
It's impossible to pass by reference int values. How to return count of matches from my DAO methods?

Which approach rather?

1) Make property "lastQueryMatches" in DAO class
2) Return custom collection
3) Return composite object which contains List and matches property
4) Make different methods?
5) Anything else?


Top
 Profile  
 
 Post subject: Re: Pagination & DAOs
PostPosted: Thu Jan 20, 2011 6:13 pm 
Newbie

Joined: Fri Jan 07, 2011 7:23 am
Posts: 19
I'm not sure I understand your question and your different approaches right.
I'm using separate methods for getting the count of a query and the result of a query.
Then for pagination the client code may store the count or not, for example to have
an upper limit for the max index but that's quite unimportant for the server part.
The client simply request one page after another, e.g. using a method like this:
List<Article> fetchBy(String name, ..., Integer start, Integer max);
where start and max would be optional.
For complex searches and in order to be able to cache results for similiar queries I do
use Objects which contain all the search parameters and the count but this is just
for checking the upper limit. They never contain the result.

Hope that helps a litte bit...


Top
 Profile  
 
 Post subject: Re: Pagination & DAOs
PostPosted: Thu Jan 20, 2011 6:22 pm 
Newbie

Joined: Mon Jan 10, 2011 7:21 pm
Posts: 8
could you explain a bit more your requirement? I'm not sure I understand what it is you are trying to achieve.

thanks,
- Savvas


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