Welcome to the new Gigaspaces XAP forum. To recover your account, please follow these instructions.

Ask Your Question

Does GigaSpaces provide any API for paging?

Hi all, Recently, I want to develop a web application and present the result by pages. Hibernate would give me a simple implementation to fulfill my purpose by setting the range of first/max result.

I have done the same in GigaSpaces' space browser and the behavior is correct, say: select uid,* from com.model.test.model.test.TestTableTwo WHERE rownum(1,5) order by id

However, I could not find any existing API for paging, say gigaSpaces.readMultiple(). Although I set the sql query as "..... rownum(1,5) order by id", eventually it throws an exception said there can be only one definition for rownum due to every signature of readMultiple() requiring max no. of entries.

{quote}This thread was imported from the previous forum. For your reference, the original is [available here|http://forum.openspaces.org/thread.jspa?threadID=3175]{quote}

asked 2009-07-14 04:18:12 -0600

hwchan gravatar image

updated 2013-08-08 09:52:00 -0600

jaissefsfex gravatar image
edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted

If GigaSpace.readMultiple does not work for you , you can use GSIterator with its IteratorBuilder.



answered 2009-07-14 08:00:21 -0600

shay hassidim gravatar image
edit flag offensive delete link more


Hi, I see in that example how to use the GSIterator to iterate, but Is there an example of how to paginate ?

Does the fact that the GSIterator doesn't support order, mean that pagination cannot be implemented?

camilocuesta gravatar imagecamilocuesta ( 2011-06-13 10:53:42 -0600 )edit

When your query involves a single indexed field using an extended index type, the result set (from each partition) will be sorted according this field values. This might be a simple solution when having a single partition.

If you have multiple partitions, you may want to use the following approach (called also persistent cursor):
Query the data without getting the entire result back, but only the IDs , routing field and the fields you want to order by, store this data within the space (persistent Result set ) and use the readByIDs to retrieve the actual result data in a paging approach. Once you are done with the result (consumed the entire result set), remove the result set object from the space.

If you need help implementing this pattern please contact: shay at gigaspaces.com.


btw - the following page include the full info about the GSIterator:

shay hassidim gravatar imageshay hassidim ( 2011-06-13 12:51:12 -0600 )edit

As I can see, we still got no any adequate solution for paging...

answered 2012-11-18 08:42:03 -0600

afrunt gravatar image
edit flag offensive delete link more


Why the Iterator builder does not work for you? Do you need to persistent the result set? Do you need a better way to move fwd or backwrd when paging the result set?

Please help us understand your requirements.


shay hassidim gravatar imageshay hassidim ( 2012-11-19 10:39:05 -0600 )edit

I found that traditional paging (i.e. limit operator in sql) doesn't fit to ideology of big data. I found a better way to display the data. Nevetheles, thank you for quick response.

afrunt gravatar imageafrunt ( 2012-11-20 05:35:49 -0600 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools



Asked: 2009-07-14 04:18:12 -0600

Seen: 891 times

Last updated: Nov 18 '12