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

Ask Your Question
0

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 -0500

hwchan gravatar image

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

jaissefsfex gravatar image
edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
0

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

See:
http://www.gigaspaces.com/wiki/display/XAP7/EDGTutorialB-GSIteratorSection

Shay

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

shay hassidim gravatar image
edit flag offensive delete link more

Comments

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 -0500 )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.

Tnx
Shay

btw - the following page include the full info about the GSIterator:
http://www.gigaspaces.com/wiki/display/XAP8/PagingSupportwithSpaceIterator

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

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

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

afrunt gravatar image
edit flag offensive delete link more

Comments

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

shay hassidim gravatar imageshay hassidim ( 2012-11-19 10:39:05 -0500 )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 -0500 )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

2 followers

Stats

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

Seen: 882 times

Last updated: Nov 18 '12