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

Ask Your Question
0

very basic question - writing and reading an object to/from a space

I feel a bit embarrassed to ask this questions, but i have spent a good number of hours trying to get it...

I am try to put a simple test class into a space and retreiving it...

Code is the following: public class Test { private Integer id; private String hello;

@SpaceId(autoGenerate = false)
public Integer getId() {return id;  }

public void setId(Integer id) { this.id = id;}

public void go() {hello = "hello";}

public static void main(String[] args)
{
    IJSpace space = new UrlSpaceConfigurer("/./IndexSpace").space();
    GigaSpace gigaSpace = new GigaSpaceConfigurer(space).gigaSpace();
    Test t = new Test();
    t.setId(10);
    t.go();
    gigaSpace.write(t);

    Test t2 = gigaSpace.readById(Test.class, new Integer(10));
    t2.speak();
}

private void speak() {System.out.println(hello); }

}

speak() should say "hello" but is actually saying null, meaning the value of the hello field cannot be retrieved as it was put in the space...

Puzzling...

Thanks for enlightening my ignorance.

Running on a Windows PC, latest downloadable version, evaluation license for now.

Seb.

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

asked 2011-12-30 11:26:32 -0500

marcse 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

Seb, I believe you are missing getter and setter methods for the hello field. Shay

answered 2011-12-30 11:31:36 -0500

shay hassidim gravatar image
edit flag offensive delete link more

Comments

Thanks Shay,

That made it. Interestingly, on the Gigaspaeces Management Center, in the space browser, Service View, when i click on the object corresponding to the class name, it does not list any property in the "Data Types Info" tab.

If i try to query the object, i get: StackTrace: com.j_spaces.core.DetailedUnusableEntryException: The operation's type description is incompatible with the type description stored in the space. Type=[com.msci.eqb.constituents.datamodel.Test], Server checksum=[-1035843038], Operation checksum=[1294491423]. Server type description: Super classes: 2 1: Type=[com.msci.eqb.constituents.datamodel.Test] 2: Type=[java.lang.Object] Properties: 2 1: Name=[hello], Type=[java.lang.String] 2: Name=[id], Type=[java.lang.Integer] Checksum: -1035843038.

Operation type description: Super classes: 2 1: Type=[com.msci.eqb.constituents.datamodel.Test] 2: Type=[java.lang.Object] Properties: 1 1: Name=[id], Type=[java.lang.Integer] Checksum: 1294491423.

Thanks again.

Seb.

marcse gravatar imagemarcse ( 2011-12-30 11:40:57 -0500 )edit

Please restart the UI. This will fix the issue.

Shay

shay hassidim gravatar imageshay hassidim ( 2011-12-30 11:42:09 -0500 )edit

That fixed it.

Thanks!.

Seb.

marcse gravatar imagemarcse ( 2011-12-30 11:44:43 -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: 2011-12-30 11:26:32 -0500

Seen: 340 times

Last updated: Dec 30 '11