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

Ask Your Question
0

Design Questions

Thanks for all your help so far, you've been a valuble resource. I have a new question about matching in a read call... I have a class which has a Collection and a String:

+class Member+
    +Collection collection;+
    +String name;+
    +public Collection getCollection() { return collection; }+
    +public void setCollection(Collection collection) { this.collection = collection; }+
    +public String getName() { retrun name; }+
    +public void setName(String name) { this.name = name;}+

Lets say I try to read a Member object out of the space:

+Member template = new Member();+
+template.setName("John");+
+Member result = gigaSpace.read(template);+

Is there a way for me to exclude Member.collection from being considered for a match? The reason I ask is that I'd like to initialize the collection variable to an empty collection so that calling objects don't have to check for null. However if the collection field is not null (but empty) it will be used as criteria in the gigaSpace.read call when I don't intend it to be. Maybe there is some special annotation I could use to declare that the read method shouldn't try to match it?

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

asked 2008-01-25 12:35:35 -0500

vpiotrow 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

Any chance the @nullValue is what you are looking for:
http://www.gigaspaces.com/wiki/display/GS6/POJOClassandFieldLevelAnnotations-6.0#POJOClassandFieldLevelAnnotations-6.0-Annotations

Another option would be to use the SQLQuery(String ClassName , String where_statement). In this case the actual object is ignored and query execution and matching is conducted via the where statement string:

SQLQuery query = new SQLQuery("Member" , "Name = 'John'");
Member result = (Member)gigaSpace.read(query);
Shay

answered 2008-01-25 15:43:33 -0500

shay hassidim gravatar image
edit flag offensive delete link more

Comments

Sure you can. In such a case make sure extended indexing is turned on. See: http://www.gigaspaces.com/wiki/displa...http://www.gigaspaces.com/wiki/displa...

Shay

shay hassidim gravatar imageshay hassidim ( 2008-01-27 20:57:48 -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: 2008-01-25 12:35:35 -0500

Seen: 46 times

Last updated: Jan 25 '08