I can't seem to figure this out. What I am trying to do is very trivial and it doesn't load.
Here are my data classes:
public class Screencap {
@Id public Long id;
public String blobkey;
@Activate(0) @Child public List<LinkData> linkDataList;
}
public class LinkData {
@Id public Long id;
@Activate(0) @Parent public Screencap screencap;
public String txt;
@Index public Date dateCreated;
}
This works and I get the right object:
ObjectDatastore datastore = OD.get();
return datastore.load(Screencap.class, screencapId);
However, this returns null!
ObjectDatastore datastore = OD.get();
return datastore.load(LinkData.class, linkDataId); //There is indeed a LinkData row with an id in the GAE datastore but it returns null!
What am I doing wrong? Also this code below work fine:
ObjectDatastore datastore = OD.get();
Screencap screencap = datastore.load(Screencap.class, screencapId);
List<LinkData> linkDataItems = datastore.find()
.type(LinkData.class)
.ancestor(screencap)
.addSort("dateCreated", SortDirection.DESCENDING)
.returnAll()
.now();