私はアプリエンジンにツリー構造を保存しようとしています。私のクラスには、親と同じタイプの子のリストがあります。 childrenプロパティを追加するまではすべて動作します。 pm.makePersistent()を呼び出すとエラーはありませんが、オブジェクトは保存されません。誰もがなぜこれがうまくいかないか知っていますか?同じ種類の子供がいるApp Engineクラス
これは私のクラスです。私はApp Engineバージョン1.2.2を使用しています。
@PersistenceCapable(identityType = IdentityType.APPLICATION)
public class Composite {
@PrimaryKey
@Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
private Key id;
@Persistent
private String name;
@Persistent
private Composite parent;
@Persistent(mappedBy = "parent")
private List<Composite> children;
public Composite(String name) {
this.name = name;
}
public Key getId() {
return id;
}
public void setId(Key id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public void setParent(Composite parent) {
this.parent = parent;
}
public Composite getParent() {
return parent;
}
public List<Composite> getChildren() {
return children;
}
public void addChild(Composite child) {
this.children.add(child);
}
}
どれ成功のような問題?あるいは、親の関係処理をDAOに移しましたか? –
私もこの問題に遭遇しました。 –