You can also "normalize" your scheme a little bit and avoid using
email as primary key.. Instead of using:


@PersistenceCapable(identityType = IdentityType.APPLICATION)
public class UserAndSomething {

    @PrimaryKey
    private Key email;

    ... more stuff ..
}


use

@PersistenceCapable(identityType = IdentityType.APPLICATION)
public class UserAndSomething {
    @PrimaryKey
    @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
    private Long key;

    ... more stuff ..

}

@PersistenceCapable(identityType = IdentityType.APPLICATION)
public class MailToKey {

    @PrimaryKey
    private Key email;

    private Long uKey;

}


and than persist something like:

  String eMail;

  PersistenceManager pm;

  UserAndSomething u = new UserAndSomething();
  pm.makePersistent(u);
  MailToKey m = new MailToKey();
  m.setEmail(eMail);
  m.setUKey(u.getKey());
  pm.makePersistent();

============

Than you can use meaningless 'long' key to communicate with client and
(via MailToKey entity) you are able to find your 'email' very quickly.
This way 'email' is visible only on the server side and no need to be
exposed on the client side.
--~--~---------~--~----~------------~-------~--~----~
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-java@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