-->
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.  [ 9 posts ] 
Author Message
 Post subject: Paginated Fetching - Design advices
PostPosted: Thu Sep 20, 2012 12:12 pm 
Beginner
Beginner

Joined: Tue Aug 29, 2006 8:08 am
Posts: 34
Hi. I've currently spent 2 days seeking for a right and presentation layer independent way of paginating (as Scrollable do not fit my memory requirements) query results.

Right now I'm nearly 100% convinced that Query.setFirstResult and Query.setMaxResults shall be my allies, however I still haven't found a way to store current #row (1st right after the last one fetched), regardless of using Jsp, WebServices or which ever presentation layer tech.

In other words, I mean to design my Query Api Core which can be used from a Desktop Swing App., a Web App or whatever.

....not sure If I explained right my intentions ...


Top
 Profile  
 
 Post subject: Re: Paginated Fetching - Design advices
PostPosted: Fri Sep 21, 2012 7:41 am 
Beginner
Beginner

Joined: Tue Aug 29, 2006 8:08 am
Posts: 34
well, in other words ::

am i responsible for keeping track of #currentRow? at the view/presentation side I guess ...


Top
 Profile  
 
 Post subject: Re: Paginated Fetching - Design advices
PostPosted: Fri Sep 28, 2012 5:32 am 
Beginner
Beginner

Joined: Tue Aug 29, 2006 8:08 am
Posts: 34
heeeelloooo out theeeeeereeeee
this thread seems like a nuclear war has devastated human race over here

:(


Top
 Profile  
 
 Post subject: Re: Paginated Fetching - Design advices
PostPosted: Mon Oct 01, 2012 4:32 am 
Hibernate Team
Hibernate Team

Joined: Fri Oct 05, 2007 4:47 pm
Posts: 2536
Location: Third rock from the Sun
what's wrong with "Scrollable" in terms of memory?

_________________
Sanne
http://in.relation.to/


Top
 Profile  
 
 Post subject: Re: Paginated Fetching - Design advices
PostPosted: Mon Oct 01, 2012 8:21 am 
Beginner
Beginner

Joined: Tue Aug 29, 2006 8:08 am
Posts: 34
sanne.grinovero wrote:
what's wrong with "Scrollable" in terms of memory?

As I understood thru all my readings/seeking/'googling' : Scrollable maintains whole bunch of data in server memory awaiting on user to request for next already retrieved from db block. That may burst my mem.


Top
 Profile  
 
 Post subject: Re: Paginated Fetching - Design advices
PostPosted: Mon Oct 01, 2012 8:35 am 
Hibernate Team
Hibernate Team

Joined: Fri Oct 05, 2007 4:47 pm
Posts: 2536
Location: Third rock from the Sun
Quote:
As I understood thru all my readings/seeking/'googling' : Scrollable maintains whole bunch of data in server memory awaiting on user to request for next already retrieved from db block. That may burst my mem.

That's true only if you are using a very silly database, or have it misconfigured. Did you actually try it out and measured some memory problem?

_________________
Sanne
http://in.relation.to/


Top
 Profile  
 
 Post subject: Re: Paginated Fetching - Design advices
PostPosted: Mon Oct 01, 2012 8:39 am 
Hibernate Team
Hibernate Team

Joined: Fri Oct 05, 2007 4:47 pm
Posts: 2536
Location: Third rock from the Sun
I might have rushed that previous post a bit. Of course the server is consuming "some" memory because of your open scrollable, but what I meant is that it should be limited and I wouldn't expect it to be a problem, so curious to see if you have measured a real problem in such a use case.

Implementing some sort of "soft scrollable" in your own app is likely going to take more memory, and quite dangerous in terms of data consistency, unless you do it all in the same DB transaction and Hibernate Session, which is going to kill a lot more memory.

_________________
Sanne
http://in.relation.to/


Top
 Profile  
 
 Post subject: Re: Paginated Fetching - Design advices
PostPosted: Mon Oct 01, 2012 2:37 pm 
Beginner
Beginner

Joined: Tue Aug 29, 2006 8:08 am
Posts: 34
To tell the truth I am just evaluating which way to go before start coding that part.
As for the Scrollable limit, you mean something like batch_fetch_size can be set?
Could yo please shoe me a snippet or refer to an url with an example like that? It would be quite appreciated.
Thanks.


Top
 Profile  
 
 Post subject: Re: Paginated Fetching - Design advices
PostPosted: Mon Oct 01, 2012 4:31 pm 
Hibernate Team
Hibernate Team

Joined: Fri Oct 05, 2007 4:47 pm
Posts: 2536
Location: Third rock from the Sun
Quote:
As for the Scrollable limit, you mean something like batch_fetch_size can be set?


Not sure what you mean with "limit" but hope these help:

http://docs.jboss.org/hibernate/core/3.6/reference/en-US/html_single/#configuration-optional
See hibernate.jdbc.fetch_size

If you search for "Scrollable iteration" in the docs you'll find an example using pagination as well.

_________________
Sanne
http://in.relation.to/


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