On Wed, Jan 25, 2012 at 1:57 AM, Jeff Schnitzer <j...@infohazard.org> wrote:
> On Tue, Jan 24, 2012 at 4:21 PM, John Goche <johngoch...@googlemail.com> > wrote: > >> > >> The main reason I ask is that loading two entities is about twice as > >> expensive as loading one twice the size. > > > > Tough. I cannot sacrifice code readability here. > > This is an intriguing attitude. > > You have arrived with a preconceived notion of exactly what you want > your Java data structure to look like and you are now trying to force > GAE into that mold. If you stay this path, you will very likely end > up abandoning appengine in frustration. At best, you will produce > software that works poorly. > > You have a long learning curve ahead of you, both in terms of learning > how the datastore works and learning how to create a data model that > is both performant and maintainable. I have two pieces of advice: > > * Read the "Storing Data" section of the GAE manual *completely*. > The nature of keys and ancestry is only one of many pieces of > knowledge you must master to develop applications here. Even though > it looks vaguely like one on the surface, this is not an RDBMS and > your learned instincts are likely wrong. Do not believe you can "just > understand JDO". > > * When you ask for help, try be somewhat more general describing what > you want to do. You're asking about how to specifically arrange > primary keys in Java classes when it may be the case that what you > want to do is embed one class in the other. There is not one > canonical way to model entities on GAE, so if you want help, start > from the perspective of "this is roughly what I'm trying to do... is > it the right way?" > > As to your specific problem, I think you'll get a lot more help if you > rephrase the question. Everyone here is just taking guesses at what > you're trying to ask. > OK, I have read all the GAE documentation relating to the datastore, including the following book: http://www.amazon.com/Essential-App-Engine-High-Performance-Developers/dp/032174263X/ref=sr_1_3?ie=UTF8&qid=1327483323&sr=8-3 which has chapter 4 describing the datastore and chapter 10 describing the low-level API. Now my use case. I have several users accessing GAE. Each user has their own store of data which they access via logging in: @PersistenceCapable class Data { // email of logged in client @NotPersistent static String loggedInClientEmail; // currently logged in user @NotPersistent static User user; // store used during current interaction @NotPersistent static Store store; // complete list of stores @Persistent static List<Store> stores; } Since each user has their own data in the datastore I could model each store as an Entity. In each session I need to read everything concerning the entity. The key characteristic of this model is that each user does not see other user's data, but each response from the server tends to includes all the data pertaining to the particular user logged in. class Store { List<User> friends; List<Item> items; } class Item { long itemCode; List<SubItem> subitems; } so what do I do, make friends and items multivalued properties of each entity? Then class Item has a list of class Subitems (but no further subsubitems). What do I do? Each entity can have a multivalued property, but then each property cannot AFAIK have multivalued subproperties. Apologies if I have given object-oriented models of my data, but these result from what the data is in the real world and are inevitable for a description. So, my question is, I have this real world data, but the documentation is not helping me to figure out how to model such data, and I need to figure out how to model it, whether with the low-level API or with JDO, couldn't care less with which API, as long as the design makes sense and is done well. Thank you for your help, (I am not interested in any other aspect of GAE, just the datastore). 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.