アプリエンジンに接続されたAndroidクライアントからRPC呼び出しを行う際に重複挿入を防止する方法を知りたいと思います。以下は私のコードと私がバックエンドで試したものですが、私がこれを行うと "内部サーバーエラー"が発生します。アンドロイド接続されたappengineのjdoを使用して重複したテーブル挿入を防止する
public void createentity(userentity e) {
PersistenceManager pm = PMF.get().getPersistenceManager();
//to go through the records and and check for duplicates
Query q = pm.newQuery("select from" + userentity.class + "where Country=='" + e.getCCNumber() + "'");
List <userentity> s = (List <userentity>) q.execute();
//if the size is equal to to null means there is no duplicate
if (s.size() == 0) {
//insert the value
try {
pm.makePersistent(e);
} finally {
pm.close();
}
}
}
@SachinDかっこいい言葉 –
@ SachinaD..ok thanks –
別のコメントに返信するときは、正しい名前に返信してください;)この場合、 '@ Rob'または' @ RobW'を使用してください。詳細については、[メタ:回答のコメントの仕組み](http://meta.stackexchange.com/questions/43019/how-do-comment-replies-work)を参照してください。 *あなたの投稿の前編集者に返信して、編集方法を教えてください。* –