johngoche9999
johngoche9999

Reputation: 1711

JDO and Google App Engine datastore: key representation in code

I have just finished watching the following videos in an attempt to understand JDO and Google App Engine datastore:

Now I wonder, take the example where we have an entity of kind Grandparent having an entity of kind Parent having an entity of kind Child as in one of the videos. The key for one of the the Child entities could be:

Grandparent:Jane/Parent:Jack/Child:Joe
  1. How do I code the class for this instance in JDO (presumably there will be three classes) but I would like to see an implementation where we can see the key values set as part of the key explicitly. Any ideas?

  2. I also wonder, what is the difference between using JDOQL to access my data and iterating through the various instances using iterators programmatically?

Thanks,

John Goche

Upvotes: 0

Views: 511

Answers (1)

proppy
proppy

Reputation: 10504

  1. There a more concrete example in the App Engine datastore java documentation: Child Objects and Relationships
  2. You can construct Datastore queries using JDOQL string syntax and by calling methods on Query objects, there is no difference when accessible the data both will return a Collection, you can see more concrete examples in Introducing Queries in JDO

Upvotes: 3

Related Questions