Hi Ian,

Not a direct answer to your question but:

I lost tons of time on jdo issue like yours where it gets very hard to
understand and few explanations / docs available.

I made some research and discovered Objectify: simple, efficient and
as powerful as jdo with the same pojo annotation philosophy, I
switched to it and will never go back because it works and I
understand why it does or why it doesn't.

Understand me: I really love App Engine but JDO/JPA are not my
preferred feature ;-)

regards
didier

On Nov 5, 4:31 pm, Ian Murdock <[email protected]> wrote:
> 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.ht...
>
> -ian
> --
> Ian Murdockhttp://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