How to enforce unique field value in java Google App Engine
- by supercobra
Hello there,
I am try to find out how to enforce uniqueness in fields other than the unique id.
Example:
@PersistenceCapable(identityType = IdentityType.APPLICATION)
public class User implements IsSerializable {
@PrimaryKey
@Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
private Long id;
@Persistent
private String name;
@Persistent
private String email; // <= I want this to be unique as well
}
In the example above, how can I enforce uniqueness of the email value across the database?
Daniel