i want to hear the best practice on establishing entity relationships in my case-
Example, for sake of discussion:- User Exam Page Question Answer As you can see, from top, each entity has 1 - many relationship with entity immediately beneath it. Interesting case is a User can have any number of Exam and it can *scale* in whatever manner, but a Exam usually will have few Pages, a Page with few Questions, Questions with few Answers I saw this interesting post best practice to persist medium-large data<http://www.mail-archive.com/[email protected]/msg06087.html> (which is also a answer to this ques) and it made me to design like this: Also i plan to keep each entity in its own entity group, as recommended by AppEngine - totally eliminating Parent relationship, as far as possible class User{ String name; // List<Key<Exam> exams; NOT a good idea, as this will unnecessarily load bulk amt of Exam keys when i load User ... } So i would use a query to get all Exams created by any User. Fine. But class Exam{ String subject; // With this i can *quickly* retrieve all Pages with keys, but as Exam and Page are not in same Entity Group, // how do i maintain *consistency* when, say, i delete a Page and accordingly remove that Key entry in Exam. // Also as said earlier, no. of pages (hence keys) shouldn't be too high, so dont need to worry abt size List<Key<Page> pages; } class Page{ String pageNo. Key<Exam> exam; // with this i can *only(?)* use query to get all Pages under a Exam, so *unnecessary index scan*[1] List<Key<Question> questions; } The same extends to Page -> Question -> Answer [1] Retrieving via Keys are faster than querying<http://www.mail-archive.com/[email protected]/msg33846.html> So what is your recommendation and why? I can suspect that it should be a trade-off between unnecessary loading of keys/extra scan of indices but want to get some thoughts and what about consistency? Thanks much in advance. p.s. though not relevant, most likely i will use low level framework, mainly Objectify.. -- 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.
