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

Ask Your Question
0

readMultiple with ExternalEntry: differences between 6.0/6.6 and 7.1

The following code works in v6.0 and v6.6: ExternalEntry searchUid = new ExternalEntry(new String[] { dataUid }); Entry[] entries = (Entry[])gigaSpace.readMultiple(searchUid, Integer.MAX_VALUE); ExternalEntry entry = (ExternalEntry)entries[0];

See also [ http://www.gigaspaces.com/wiki/displa... ] after which I believe the code above was mimicked.

The readMultiple method signature in v7.1 is: <t> T[] readMultiple(T template, int maxEntries)

However, in v7.1 the code above fails at run time with "java.lang.ClassCastException: [Ljava.lang.Object;" .

ClassCastException is also thrown when using this (think T = ExternalEntry): ExternalEntry[] entries = gigaSpace.readMultiple(searchUid, Integer.MAX_VALUE);

Modifying the code like this seems to fix the problem: Object[] entries = gigaSpace.readMultiple(searchUid, Integer.MAX_VALUE); ExternalEntry entry = (ExternalEntry)entries[0];

Is this a known problem in v7.1?

Also, should we change the code over to use readById?

Thanks, Vanio

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

asked 2010-06-23 10:37:57 -0600

vanio gravatar image

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

jaissefsfex gravatar image
edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

Vanio,
Please change the code to use readById and readByIds. See:
http://www.gigaspaces.com/wiki/display/XAP71/SpaceObjectIDOperations
http://www.gigaspaces.com/wiki/display/XAP71/ParentChildRelationship

There is no need to use the ExternalEntry any more.

Shay

answered 2010-06-23 13:55:53 -0600

shay hassidim gravatar image
edit flag offensive delete link more

Comments

OK - readById/readByIds it is then (I understand readByIds is available since 7.1.1).

Thank you, Shay!

\- Vanio

vanio gravatar imagevanio ( 2010-06-23 14:18:10 -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

1 follower

Stats

Asked: 2010-06-23 10:37:57 -0600

Seen: 29 times

Last updated: Jun 23 '10