views:

101

answers:

1

I'm trying to save a tree structure in app engine. My class has a parent and a list of children of the same type. Everything works until I add the children property. There are no errors when I call pm.makePersistent(), but the object is not saved. Does anyone know why this doesn't work?

This is my class. I'm using App Engine version 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);
    }
}
A: 

Look at the issue tracker for GAE/J DataNucleus plugin. Issues like

Issue 73

Issue 125

DataNucleus
That's bad. Being able to construct tree like data structures is pretty important :-(
Patrick Cornelissen