Hi,
I'm building a service similar to twitter, where users can follow one
another. My user class looks like this:
@PersistenceCapable
class User {
@PrimaryKey
private String mUsername;
}
I'm thinking to store the follower/followee relationships in an
intermediate class, and am not sure if this makes sense, or if there
is a better way to do it. I'm thinking of the case where I'm viewing
another user's info page, and want to follow them. Then I'd create a
new object like this:
@PersistenceCapable
class Relationship {
@PrimaryKey
@Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
private Key mKey;
@Persistent
private String mFollowerUsername;
@Persistent
private String mFolloweeUsername;
}
I can then query for the first N records above when needing to show a
list of followers, and page as necessary. Is there a better pattern
for doing this? I was reading this post:
http://groups.google.com/group/google-appengine/browse_thread/thread/18bddc764f2647b9/d567b638a201fde8?lnk=gst&q=follower#d567b638a201fde8
where Brett suggested storing the follower/followee user ids directly
in the User object (perhaps as an ArrayList<String>). In some sense
this would be easier but if those lists have 10,000 entries each,
won't it take a long time to load the User object? Loading user
objects probably is a frequent action in my case. Also to support
adding and deletion of followers, I'd need to search the
ArrayList<String> for duplicates (guess I could use a set<String>
instead.
Not sure if this question belongs here, it seems pretty JDO specific,
but I'm wondering what the best way to do this is so it scales well on
app engine,
Thank you
--
You received this message because you are subscribed to the Google Groups
"Google App Engine" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-appengine?hl=en.