Regarding Lazy loading in spring data graph.

371 views
Skip to first unread message

gokulakanna balakrishnan

unread,
Aug 10, 2012, 9:47:30 PM8/10/12
to ne...@googlegroups.com

Hi All,

   @Fetch - eager fetching. Is it possible to implement lazy loading in spring data graph.
  
Thanks & Regards,
Gokul

Michael Hunger

unread,
Aug 10, 2012, 10:22:31 PM8/10/12
to ne...@googlegroups.com
lazy loading is the default

use template.fetch(object.field) to fetch on demand

Michael

gokulakanna balakrishnan

unread,
Aug 10, 2012, 10:44:07 PM8/10/12
to ne...@googlegroups.com
Hi Michael,

If I need to fetch the data in GUI layer I Could not invoke the
template.fetch(fetch id).

If i need to fetch the Relation(Collection set). In this is case how i
can fetch my relations.

Please advice me for above two scenarios.

Thanks & Regards,
Gokul

Michael Hunger

unread,
Aug 10, 2012, 10:54:00 PM8/10/12
to ne...@googlegroups.com
What was the issue?

template.fetch(object.single_rel)
template.fetch(object.set)

gokulakanna balakrishnan

unread,
Aug 10, 2012, 11:09:24 PM8/10/12
to ne...@googlegroups.com
Hi Michael,

I have to add new teams the user like following way.

user.getGroupSet().add(group); --- Previously i was using egar
fetch so i able to achieve with out loading i able to add new group
for the user.

Same way I able to display the all the grops whcich user created.
following way.

<s:iterator value="user.groupSet" status="stat"> ---
</s:iterator>

Above case I could not diplay the groups like above because of lazy
loading . We have to load groupSet separetly. Is it correct?

Thanks & Regards,
Gokul

On Sat, Aug 11, 2012 at 8:24 AM, Michael Hunger

Michael Hunger

unread,
Aug 11, 2012, 2:34:19 AM8/11/12
to ne...@googlegroups.com
Then you have to use either @Fetch oe template.fetch()


You can also use template.creatRelationshipBetween() to create rels w/o fetching all

Sent from mobile device

gokulakanna balakrishnan

unread,
Aug 11, 2012, 12:46:33 PM8/11/12
to ne...@googlegroups.com
Thanks alot Michael.

gokulakanna balakrishnan

unread,
Aug 11, 2012, 1:30:21 PM8/11/12
to ne...@googlegroups.com
Hi Michael,
 
     I dont have any separate relationship class. Is it possible to pass null as argurment for RelationshipClass parameter or I have to create relationship class separetly.
 
     userRepository.createDuplicateRelationshipBetween(user, createUserAcheivement(userAcheivementsDTO), null, RelationShipConstants.USER_ACHEIVEMENTS);
 
Thanks & Regards,
Gokul

Michael Hunger

unread,
Aug 11, 2012, 4:54:45 PM8/11/12
to ne...@googlegroups.com
I don't have the code at hand can you try to pass either null or just Relationship.class ?

Thx

Michael

gokulakanna balakrishnan

unread,
Aug 11, 2012, 10:25:07 PM8/11/12
to ne...@googlegroups.com
Sure Michael.
 
Thanks & Regards,
Gokul

Reply all
Reply to author
Forward
0 new messages