私はgetKey()この種のエンティティを扱う必要があります:
@Entity
public class Value {
@Id
private long id;
private byte[] value;
com.googlecode.objectify.Key<Value> getKey() {
return com.googlecode.objectify.Key.create(Value.class, id); // When executed this line throws NullPointerException
}
// Code omitted
}
ただし、以前バージョン3で使用したパターンは、もう適用できないようです。は@Transientに置き換えられます@Ignoreが、getKey()関数に注釈を付けると、次の@Ignoreエラーが発生します。
The annotation `@Ignore` is disallowed for this location
だから私はそれをコメントアウトしました。そして、それが機能するかどうかを確認します。
さらに、
アプリケーションを実行すると、上記のコメントのようにgetKey()関数がスローされます。NullPointerException
@Entityでは、キーを取得するためのパターンは何ですか?