I think that you need a key object first, e.g. Key formatkey = KeyFactory.createKey(Format.class.getSimpleName(), formatId); forma = (Format) pm.getObjectById(Format.class, formatkey );
On Aug 10, 11:19 am, aprendiz <[email protected]> wrote: > Hello, I have a (owner) one-to-many bidirectional relationship. > A product can have multiple formats, but a format can only be > associated with a product. > > public class Product{ > @PrimaryKey > @Persistent > private Key id; // string, by application > ... > @Persistent(mappedBy = "product") > private List <Format> formats; > > } > > public class Format{ > @PrimaryKey > @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY) > private Key id; //numeric, autogenerated > ... > @Persistent > private Product producto; > > } > > Users select a format in a web page (radio button html) and > application (servlet) must load the object identified by id. > > My code: > forma = (Format) pm.getObjectById(Format.class, formatId); // formatId > = 985 > > but I get: > Could not retrieve entity of kind Format with key Format(985) > > Datastore Viewer shows a entity with ID/Name column = 985. > > How I must load object? What is wrong? > Thank you! -- 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.
