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

Ask Your Question

SpaceID format

I wonder in which format SpaceID generated by Gigaspaces. It looks like this "A0^1408270404945^1", where the last portion is incrementing for each new item. Can it be parsed into number?

asked 2014-08-17 06:42:54 -0500

Jenya gravatar image
edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

Hi Jenya,

It is depends whether you are using auto-generate=false or auto-generate=true. When auto-generate=false - the UID is generated based on the value of the ID field you are setting (it will be a number + some characters). When auto-generate=true - the UID is generated by the space (it will be a number + some more info) and placed back into the field using the relevant setter method. In this case, the field must be a java.lang.String type. Anyhow on both cases you should not pars it as a number. It is a String. You can read more about it here: http://docs.gigaspaces.com/xap97/spac... http://docs.gigaspaces.com/sbp/global...



answered 2014-08-17 08:54:42 -0500

Yuval gravatar image
edit flag offensive delete link more


Yuval, thanks for the answer. I'm using "auto-generate=true". I've seen both articles. I should clarify - in our client application we need some unique incrementing identifier for each entity that stored in Gigaspaces (similar to Identity column in SQL DB). I've seen that there is Counters, but why not to use SpaceID, that seems to be close to what I need. I understand that is String, and my question is whether I can pars only the last part of it and rely on that it will be unique and incremental?

Jenya gravatar imageJenya ( 2014-08-17 09:24:00 -0500 )edit

Hi Jenya,

Parsing and relying on this number is wrong. What you can do is creating your own method using @BeforeWrite annotation. Please read more about it here: http://docs.gigaspaces.com/xap97/the-...



Yuval gravatar imageYuval ( 2014-08-17 09:48:58 -0500 )edit

OK. Thanks.

Jenya gravatar imageJenya ( 2014-08-17 09:57:34 -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


Asked: 2014-08-17 06:42:54 -0500

Seen: 13,928 times

Last updated: Aug 17 '14