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

Ask Your Question
0

@SpaceVersion required for Local Cache?

Hi,

I am using a Local Cache with an External Data Source. According to the wiki ( http://www.gigaspaces.com/wiki/displa... ) and a previous forum post (/[/question/5236/problem-using-local-cache/?answer=5237#post-id-5237]─) I need to have my POJOs annotated with the @SpaceVersion annotation.

I need to have this local cache, but I would prefer not to have to annotate all of my POJOs.

I am getting the following exception: org.openspaces.events.adapter.ListenerExecutionFailedException: Listener event method 'processData' threw exception; nested exception is org.openspaces.core.RemoteDataAccessException: fail while caching; nested exception is: java.lang.IllegalArgumentException: Write operation requires object version greater than 0 when using local cache. Object=(class=com.tricode.tmtplatform.odh.common.Page,uid=-134051724^39^DevSpace_container1:DevSpace^1223634037467^957,version=0); nested

I think my read operation tries to write a copy to the cache but fails because to POJO's version is 0.

Is there a way of using a local cache without anootating my POJO's?

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

asked 2008-10-10 06:52:36 -0600

john 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

To resolve this issue you need to have a field that will accommodate the
versioned , annotate its getter with @SpaceVersion and set it value to 1
once data loaded from the database.

The other option would be to decorate your POJO using gs.xml.

Shay

answered 2008-10-10 07:12:49 -0600

shay hassidim gravatar image
edit flag offensive delete link more

Comments

Hi Shay,

I forgot about the possibility of decorating using gs.xml. But in that case I still need to decorate all my POJOs.

In this thread (//question/5236/problem-using-local-cache/?answer=5237#post-id-5237) you say this @SpaceVersion is used for optimistic locking, which is default in a local cache. Is it possible to change this? I only need this cache for read-operations.

john gravatar image john  ( 2008-10-10 07:24:35 -0600 )edit

If I'm not wrong we check the version number before placing the object into the local cache in any case. We are working these days on a new local cache impl (for POJOs and space API) that is targeted for Id based operations. It is much faster than the regular local cache we have right now.

Please drop me a line if you would like to try it.

Shay at gigaspaces.com

Shay

shay hassidim gravatar image shay hassidim  ( 2008-10-10 07:46:19 -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: 2008-10-10 06:52:36 -0600

Seen: 60 times

Last updated: Oct 10 '08