Hi,

I am experiencing a problem after upgrading to Java SDK 1.2.5. In a
simple CMS application a page is stored as a CMSPage entity, which
points to its text saved as a DetachedText entity using a Key property
(i.e. an unowned relationship) as follows:

@PersistenceCapable(identityType = IdentityType.APPLICATION)
public class CMSPage {

  @PrimaryKey
  @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
  private Key id;

  @Persistent
  private Key text;

  public Key getId() {
    return id;
  }

  public void setId(Key id) {
    this.id = id;
  }

  public Key getText() {
    return text;
  }

  public void setText(Key text) {
    this.text = text;
  }

}

The Key property "text" points to:

@PersistenceCapable(identityType = IdentityType.APPLICATION)
public class DetachedText {

  @PrimaryKey
  @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
  private Key id;

  @Persistent
  private Text content;

  public DetachedText(Text content) {
    this.content = content;
  }

  public Key getId() {
    return id;
  }

  public Text getContent() {
    return content;
  }

}

NOTE: I have removed other properties and code that I found unrelated
to the problem

After saving the page I can see the "text" field populated in the
development console. The value shows as "DetachedText(5)". I also
verified that the DetachedText entity exists and its ID equals 5.

However, after I retrieve CMSPage from the datastore using a
javax.jdo.Query the "text" field in the retrieved object is null (both
the Eclipse debugger and the application throwing NPE confirm it).

What am I doing wrong?

Any pointers will be appreciated.

Thanks,

Yegor
--~--~---------~--~----~------------~-------~--~----~
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 google-appengine-java@googlegroups.com
To unsubscribe from this group, send email to 
google-appengine-java+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to