我嘗試瞭解如何在唯一標識符以外的字段中實施唯一性。如何在java Google App Engine中執行唯一字段值
實施例:
@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
}
在上面的例子,如何可以執行跨數據庫的電子郵件值的唯一?
丹尼爾
這個工作很好地滿足我的需求。很聰明。 – Patrick 2012-05-17 12:17:12
我很高興它幫助:) – 2012-05-17 15:25:23
不錯的方法,我已經開始做類似於Peter Recore上面描述的東西了,但是這樣也能解決我的問題,並且代碼少得多。 – 2013-03-31 10:06:00