On Tue, Jan 24, 2012 at 10:31 PM, Ikai Lan (Google) <ika...@google.com>wrote:

> You don't need to implement a Primary Key class. Specify the primary field
> as a Key and generate the key using KeyFactory:
>
>
> http://code.google.com/appengine/docs/java/javadoc/com/google/appengine/api/datastore/KeyFactory.Builder.html
>

Thank you for your reply, but what is a key with ancestors?


>
> You can autogenerate IDs with this method:
>
>
> http://code.google.com/appengine/docs/java/javadoc/com/google/appengine/api/datastore/KeyRange.html
>
> You'll probably get more mileage persisting the object in a single entity
> (treating the datastore more like a key-value store) and using a
> translation later to turn it into classes to work with than trying to do
> magic trying to get these classes to persist the way you want them to.
>

Can you give me an example? In my code I have the following:

class Data {
  static List<A> la;
}

class A {
  B foo;
  C bar;
  List<D> foobar1;
  List<E> foobar2;
}

class B {
  String k; // (needs to be the primary key of A)
  //...
}

I only need persist la, but I have the given class structure and have made
everything
persistencecapable. Not sure if this is the way to go.


> In my opinion, you're not sacrificing code readability - you're just
> moving work around.
>

So how would I move stuff around in the example given above?

Thanks,

John Goche

-- 
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