Hi:

Has anyone figured out the use of generated long id in @PrinaryKey to
build a complete key graph. If not possible, what is the best technique
to generate long id for a complete graph of parent-child relationship.
Following is a use case:

UserOrg is the root entity with userId = "f...@budhnet.com" which
generate a 'message' sent to a list of receivers.

public class UserOrg {
  @PrimaryKey private Key rootKey;
  // the key is generated as
  rootKey = KeyFactory.createdKey(UserOrg.class.getSimpleName(),
userId);

public class Message { //whose instance is generated by a userId
  @PrimaryKey private Key messageKey;
  // can the key be generated as one of the 2 followings
  messageKey = new KeyFactory.Builder(UserOrg.class.getSimpleName(),
userId).addChild(Message.class.getSimpleName(), messageKey.getId
()).getKey();
  or Key rootKey = KeyFactory.createKey(UserOrg.class.getSimpleName(),
userId);
  messageKey = KeyFactory.createKey(rootKey, MessageClass.getSimpleName
(), rootKey.getChild().getId());

  If not, what is the best practice in generating the long id for child
message of a userId. Same thing would apply for the MessageIndex of
receiver list.

public class MessageIndex { // child of the message created by userId
  Key rootKey = KeyFactory.createKey(UserOrg.class.getSimpleName(),
userId);
  messageKey = KeyFactory.createKey(rootKey, MessageClass.getSimpleName
(), rootKey.getChild().getId());

  @PrimaryKey private Key messageIndexKey;
  messageIndexKey = KeyFactory.createKey(messageKey,
MessageIndex.class.getSimpleName(), messageKey.getChild().getId());

The exercise is getting more complex for set intersection as shown in
python in
http://code.google.com/events/io/2009/sessions/BuildingScalableComplexApps.html 

Has anyone worked out the Java code of the demos? the author?
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 google-appengine-j...@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine-java+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en.


Reply via email to