GWT アプリの GAE データストアを管理するために Objectify を使用しています。問題は、クエリを適切に使用していないことであり、以下のように UmbrellaExceptions が発生します。
Caused by: java.lang.RuntimeException: Server Error: java.lang.String cannot be cast to java.lang.Number
at com.google.web.bindery.requestfactory.shared.Receiver.onFailure(Receiver.java:44)
Box
一意のフィールドを持つクラスがあるとしますString id
。Boxオブジェクトを取得したいid == "cHVQP6zZiUjM"
これは私が今それを行う方法です:
public Box getBox(String boxId)
{
Objectify ofy = ObjectifyService.begin();
Query<Box> q=ofy.query(Box.class).filter("id",boxId);
Box targetBox = q.get();
return targetBox;
}
@Entity
public class Box extends DatastoreObject{
private String id;
private String title;
}
ofy.load() でこれを実行しようとしましたが、そのメソッドはクラス Objectify で定義されていません (理由はわかりません)。