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

Ask Your Question

Gigaspaces and Hibernate


I am currently looking at building a small app to demonstrate the use of Data Grid using GigaSpaces and Hibernate. Unfortunately I'm struggling to get the example to work. I have looked at the hibernate gigaspaces integration from openspaces and modified my code. I have created a small maven project with a simple integration test that creates an embedded space (sync replication I presume uses embeddded space whereas async uses a mirror service). I would like to demonstrate the use of Data grid to my colleagues and manager. Would it be possible if anyone could be able to help and point out what I am doing wrong?



  1. gigaspaces.test.zip

This thread was imported from the previous forum.
For your reference, the original is available here

asked 2009-05-25 00:16:21 -0500

amin1977 gravatar image

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

jaissefsfex gravatar image
edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted

Yes - you are correct. All you need to do is to construct a mirror PU and deploy it.

You will need to change the pu.xml you are using now that start the data grid to have:

<prop key="space-config.external-data-source.usage">read-only</prop>

This will make sure updates to the database will go only via the Mirror service.


answered 2009-05-28 14:35:05 -0500

shay hassidim gravatar image
edit flag offensive delete link more


I managed to get it working.

Cheers Amin

answered 2009-05-25 15:44:11 -0500

amin1977 gravatar image
edit flag offensive delete link more



I have a question and I was wondering if I could get some help with this.

Basically I have a configured my Repository classes to use DataGrid via GigaSpaces API. Am I correct in thinking that if I want asynchronous replication of changes made to data on the space and data source I need to create a Mirror PU? This PU would effectively just have a PU.xml. I was reading on the documentation that you require a DataGrid processing unit but I'm not sure why. For example I have the following config defined in my application:

<bean id="space" class="org.openspaces.core.space.UrlSpaceFactoryBean"> <property name="url" value="/./mySpace"/> <property name="schema" value="persistent"/> <property name="mirror" value="true"/> <property name="externalDataSource" ref="hibernateDataSource"/> <property name="properties"> <props> <prop key="space-config.external-data-source.usage">read-write</prop> <prop key="cluster-config.cache-loader.external-data-source">true</prop> <prop key="cluster-config.cache-loader.central-data-source">true</prop> <prop key="cluster-config.mirror-service.url">jini://*/mirror-service_container/mirror-service</prop> <prop key="cluster-config.mirror-service.bulk-size">100</prop> <prop key="cluster-config.mirror-service.interval-millis">2000</prop> <prop key="cluster-config.mirror-service.interval-opers">100</prop> <prop key="cluster-config.groups.group.repl-policy.repl-original-state">true</prop> </props> </property> </bean>

Therefore I presume all I know need is to deploy the mirrior PU as described in the documentation. Am I correct?

Any help would be appreciated.



amin1977 gravatar imageamin1977 ( 2009-05-28 14:22:58 -0500 )edit

Hi Shay

Thanks for your reply. The space configuration that I have should use read-only or should the pu.xml only use read-only?

Cheers Amin

amin1977 gravatar imageamin1977 ( 2009-05-28 14:51:24 -0500 )edit

The space configuration you use should have space-config.external-data-source.usage=read-only. If you use pu.xml to deploy your space this property should be placed there.


shay hassidim gravatar imageshay hassidim ( 2009-05-28 15:17:06 -0500 )edit

Hi Shay

I'm running on practically zero sleep (2 kids to deal with) so I need to do the following:

for GigaSpaces API (one to write to the space) configuration the space bean definition should include:


And the mirror pu.xml should also contain


Thanks and sorry for asking this question again! :)

amin1977 gravatar imageamin1977 ( 2009-05-28 15:59:18 -0500 )edit

mirror pu.xml should not have the space-config.external-data-source.usage property set.

shay hassidim gravatar imageshay hassidim ( 2009-05-28 16:03:07 -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


Asked: 2009-05-25 00:16:21 -0500

Seen: 125 times

Last updated: May 25 '09