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

Ask Your Question
0

How to read all the elements for the particular data type from gigasapce

I need to load the entries in the cache of MyClass object. How to load this using SQLQuery ? Or is there any other way? or always i need to pass the second parameter (SQLExpression)?

SQLQuery<myclass> query = new SQLQuery<myclass>(MyClass.class, "num = 1"); MyClass[] result = gigaSpace.readMultiple(query);

Edited by: Gopinathan Mani on Mar 18, 2013 10:00 AM

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

asked 2013-03-18 09:41:54 -0500

get4gopim gravatar image

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

jaissefsfex gravatar image
edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

If you want to read the entire space class objects you can do this:

SQLQuery<MyClass> query = new SQLQuery<MyClass>(MyClass.class, "");
MyClass[] result = gigaSpace.readMultiple(query);

or this:

MyClass[] result = gigaSpace.readMultiple(new MyClass());

Make sure you have default no-arg constructor that set all fields to null when using the second option.

If you have large amount of objects you may us the GSIteraor (like a DB cursor) and get data in a sliding window pagination approach:
http://wiki.gigaspaces.com/wiki/display/XAP91/PagingSupportwithSpaceIterator

Last option would be to use the Task Executor and instead reading the entire data back to the client , send the business logic to the space to return some result data. This will avoid the network overhead and serialization:
http://wiki.gigaspaces.com/wiki/display/XAP91/TaskExecutionovertheSpace

Shay

answered 2013-03-18 10:00:53 -0500

shay hassidim gravatar image
edit flag offensive delete link more

Comments

Thanks Shay,

I will use the first option, I have only 2000 data in cache.

get4gopim gravatar imageget4gopim ( 2013-03-18 10:06:26 -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

1 follower

Stats

Asked: 2013-03-18 09:41:54 -0500

Seen: 230 times

Last updated: Mar 18 '13