According to this, Google App Engine's JDO implementation does not support JDO @Unique annotation. Is this still so?
For example, I have this class:
@PersistenceCapable
public class User {
@PrimaryKey
@Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
private Key key;
@Persistent
private String email;
@Persistent
private String sessionToken;
...
}
Obviously the key
is unique, but I also wanted to have unique email
and sessionToken
. If @Unique is not supported, what's the best way to "simulate" this behaviour in terms of both simplicity and performance?
The issue linked from that can't be clearer. JDO is not the problem .... the problem is the underlying GAE/Datastore database not supporting it (and if the datastore doesn't support it then there's no way an API can magically impose something in the datastore). That issue also gives a workaround