google-code-export / morphia

Automatically exported from code.google.com/p/morphia
1 stars 0 forks source link

Custom lazy load fetching strategy #343

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
I will talk about an idea.

For instance, I want to lazy load something such as

    @Entity class User {
        @Reference(lazy=true) private List<User> friends;
    [...]
    }

However maybe I don't want to fetch friends from database. Because I already 
fetched them and cached them in a key e.g. "user_ef5a2a349_friends". I want to 
load it from there, however if I just request "friends" once, proxy will 
intercept the request and fetch maybe thousands of User objects from listed in 
"friends" from database.

This is so bad for me. Does anyone have an idea on how can I implement a custom 
lazy fetching strategy in Morphia? Thanks.

Original issue reported on code.google.com by ahmetalp...@gmail.com on 22 Nov 2011 at 10:25

GoogleCodeExporter commented 9 years ago
Don't use @Reference, do it yourself.

It is best to ask these question in the group: 
http://groups.google.com/group/morphia/

Original comment by scotthernandez on 22 Nov 2011 at 5:44

GoogleCodeExporter commented 9 years ago
Excuse me for that. Thank you, joined the group and will ask there.

Original comment by ahmetalp...@gmail.com on 22 Nov 2011 at 5:47