Thanks Jeff.
There seems to be something at odd:
On Tue, 2010-01-26 at 16:40 -0800, Jeff Schnitzer wrote:
> Here's the Objectify version of what's described in the video, capable
> of a photo-equivalent of "million user fanout":
>
> class Album {
> @Id Long id;
> String name;
> }
> class PhotoIndex {
> @Id Long id;
> @Parent OKey<Album> album;
> Set<OKey<Photo>> photos;
> }
> class Photo {
> @Id Long id;
> String caption;
> String blobStoreKey;
> }
>
> If you want to ask "what albums are this photo in?" (equivalent to
> "what messages are waiting for me" in the video), you query like this:
>
> OQuery<PhotoIndex> query =
> createQuery(PhotoIndex.class).filter("photos", photoKey);
> List<OKey<Album>> keys = ofy.prepareKeysOnly(query).asList();
> List<Album> albums = ofy.get(keys);
>
> Jeff
>
In the above query to ask what albums are this photo in, I wonder if it
is legitimate to cast List of PhotoIndex keys with List<OKey<Album>> so
you can get a particular photoKey in a list of albums.
Using the same structure for User, MessageIndex and Message, the query
seems to ask for a list of users, a particular message is sent to?
class User {
@Id Name userId;
}
class MessageIndex {
@Id Long messageIndexId;
@Parent OKey<User> userKey;
List<OKey<Message>> messageKeys;
}
class Message {
@Id Long messageId;
String ccontent;
}
To query the list of users a particular messageKey is sent to:
OQuery<MessageIndex> query =
ObjectifyService.createQuery(MessageIndex.class).filter(messageKeys,
messageKey);
List<OKey<User>> userKeys = ofy.prepareKeysOnly(query).asList();
List<User> users = ofy.get(userKeys);
To query what messages are waiting for me:
OQuery<MessageIndex> query = ObjectifyService.createQuery
(MessageIndex.class).filter(userKey, meKey);
List<OKey<Message>> listOfMessageKeys = ofy.prepareKeysOnly
(query).asList();
// iterate through listOfMessageKeys and each iteration, get a batch of
messages sent to meKey?
Can GQL of python be used in Objectify?
Thanks
Duong BaTien
DBGROUPS and BudhNet
--
You received this message because you are subscribed to the Google Groups
"Google App Engine for Java" 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-java?hl=en.