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

Ask Your Question
0

Whta is recomanded way to work with collections?

I have not found how do you recomand to work woth collections.

Lets say I have Person - City relation thats say person live in one city. (1 to n relation)

both of them beeing space entity.

Now I load one person, it will load the city with him, and with the city every single person in the city.

So how do I replicate lazy loading from hibernate?

What is the best practice?

have in the POJO of City in the get method space.readMultiiple or what?

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

asked 2009-07-30 05:46:25 -0600

hurda 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

You should have a method within the parent object that will retrieve the child objects or have such within the DAO layer. These should call the readMultiple or use executors to fetch a subset of the child object data or have some recursive data retrieval implemented for multiple layers.

You could hold the ID of the parent within the child objects for fast data retrieval of the child objects or hold the IDs of the child objects within the parent object. See fully running examples here:
http://www.gigaspaces.com/wiki/display/XAP7/POJOSupport-Advanced#POJOSupport-Advanced-ParentChildRelationship
http://www.gigaspaces.com/wiki/display/CCF/Exercise3-PortingthePetClinictoGigaSpaces

The XAP 7.0 GigaSpace.readByID should help you very much. You will add also GigaSpace.readByIDMultiple soon.

Shay

answered 2009-07-30 05:57:51 -0600

shay hassidim gravatar image
edit flag offensive delete link more

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: 2009-07-30 05:46:25 -0600

Seen: 63 times

Last updated: Jul 30 '09