Hi,

I'm having a problem with embedded objects.

My code looks something like this:

    @PersistenceCapable
    public class Parent {
        @PrimaryKey
        @Persistent(valueStrategy=IdGeneratorStrategy.IDENTITY)
        @Extension(vendorName="datanucleus", key="gae.encoded-pk", value="true")
        private String key;

        @Persistent
        @Embedded
        private Child child;

        public Child getChild() {
            return child;
        }

        public void setChild(Child child) {
            this.child = child;
        }
    }

    @PersistenceCapable
    @EmbeddedOnly
    public class Child {
        @Persistent
        private String field;

        public Child(String field) {
            this.field = field;
        }
    }

With the code as above, I create an entity and persist it:

    Parent parent = new Parent();
    parent.setChild(new Child("foo"));
    persistenceManager.makePersistent(parent);

Looking at the data store, I see there's a property in Parent
called "field", and it has the value "foo" as expected.
However, when I read the Parent object back from the data
store, parent.getChild() returns null. If I remove the
@Embedded and @EmbeddedOnly annotations and add a key
to Child, parent.getChild() returns the child properly.

Looking at the DataNucleus documentation [1],
I see there are "nullIndicatorColumn" and "nullIndicatorValue"
attributes to @Embedded, but setting e.g.
nullIndicatorColumn to "child" doesn't seem to have any effect

Am I doing something wrong?

[1] 
http://www.datanucleus.org/products/accessplatform/jdo/annotations.html#Embedded

-ian
-- 
Ian Murdock
http://ianmurdock.com/

"Don't look back--something might be gaining on you." --Satchel Paige

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine for Java" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en.

Reply via email to