views:

30

answers:

0

Hello,

I'm still trying to persist a list of serializable objects. I would expect this to be a standard collection as described here: http://code.google.com/appengine/docs/java/datastore/dataclasses.html#Collections

That gave me an exception complaining that: FooObject is not a supported property type.

When that didn't work, I tried flagging FooObject as @PersistenceCapable and @EmbeddedOnly. I also tried flagging the list as @Element(serialized="true"). These annotations did silence the exceptions, but didn't solve my problems, because now the list is always empty.

Everything works as expected if I replace my serializable class (FooObject) with String.

How can I persist my list of FooObjects using JDO?

Thanks!

=== EDIT: Add Sample Code Below ===

public class FooObject implements Serializable
{
    private final String name;
    public FooObject(String name)
    {
        this.name = name;
    }
    public String toString()
    {
        return name;
    }
}


@PersistenceCapable
public class Entity
{
    @Element(serialized="true")
    List<FooObject> foos = new ArrayList<FooObject>();

    public void addFoo(FooObject foo)
    {
        foos.add(foo);
    }
    public List<FooObject> getFoos()
    {
        return foos;
    }
}