-->
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.  [ 7 posts ] 
Author Message
 Post subject: Paging and Update
PostPosted: Wed Aug 18, 2004 2:31 pm 
Beginner
Beginner

Joined: Wed Aug 18, 2004 10:03 am
Posts: 28
Problem:

I use paging with setMaxResult() and setFirstResult() in my application, and the pagination works, but, i have a problem when the database was updated.
I need to solve it, but i don't have idea, can any help me


Top
 Profile  
 
 Post subject:
PostPosted: Wed Aug 18, 2004 4:07 pm 
Beginner
Beginner

Joined: Thu Jul 22, 2004 2:15 pm
Posts: 35
You question is not very clear..

but if the database is updated, you refresh will include the new results. Thats very desired.

what some people do is, get ALL the results at one time, and then use pagination on those stored results. These results can sit in some kind of cache, or session or request scope, wherever they find it should be at.

HTH

_________________
--------------------------------------------------
To code or not to code... Is that a question?
--------------------------------------------------
Pritpal Dhaliwal


Top
 Profile  
 
 Post subject:
PostPosted: Wed Aug 18, 2004 4:22 pm 
Beginner
Beginner

Joined: Wed Aug 18, 2004 10:03 am
Posts: 28
Scuse me, but, i erase in the previous post same data... :)

My problem is that when i paging data, if other user update the database, then, i need to show consistent refresh.

Your solution of get all the results at one time, is very expensive, and i need a scalable solution.

Thank you for all, and i hope that you and other understand my now.

Regards
epsino

PD: Mi english is very poor :-P


Top
 Profile  
 
 Post subject:
PostPosted: Wed Aug 18, 2004 8:20 pm 
Expert
Expert

Joined: Sat Jun 12, 2004 4:49 pm
Posts: 915
You can user ScrollableResults

regards


Top
 Profile  
 
 Post subject:
PostPosted: Wed Aug 18, 2004 10:31 pm 
Beginner
Beginner

Joined: Wed Aug 18, 2004 10:03 am
Posts: 28
I read that the ScrollableResult not is good, and is not recomended, it is true


Top
 Profile  
 
 Post subject:
PostPosted: Thu Aug 19, 2004 11:00 am 
Beginner
Beginner

Joined: Wed Aug 18, 2004 10:03 am
Posts: 28
ScrollableResult needs an open session as iterate


Top
 Profile  
 
 Post subject:
PostPosted: Thu Aug 19, 2004 11:17 am 
Expert
Expert

Joined: Sat Jun 12, 2004 4:49 pm
Posts: 915
I think that history from setMaxResult and SetFirstResult is from mysql or postgresql LIMIT clause (not in sql standard)
They do query like :
parse
bind
fetch all rows

When we have big table all rows can't be in memory and guys from MySQL and Postgersql add LIMIT (postgresql have cursor now and do work like oracle)

Oracle do next (this is correct way for query)
parse
bind
fetch one or more rows (but no all)

We don't need limit - we only return rows which we want

Hibernate emulate LIMIT on oracle with query and use rownum, but it isn't necessery - we can use every query and return any rows

ScrollableResult is better way for this, but I don't know is it work in Hibernate

regards


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