Alex, There's a danger here of overengineering when it comes to mapping objects to datastore entities. Unless you absolutely need different behavior between the subclasses of Animal, you may want to stay away from using types to convey information and use a field instead. In the datastore, entities are actually loosely typed, and you can specify the type of Animal in a field rather than as an Entity kind. This may or may not be your actual example, so I may be way off base here.
As far as creating a DAO layer goes - what do you mean? Are you referring to creating a DAO layer by creating a DAO class for each domain class? On Tue, Dec 1, 2009 at 7:44 AM, djd <[email protected]> wrote: > Hi guys, > I need your opinion regarding this "issue" : > > The persistence classes get more complex as the application grows and > gets more complex. For my question, consider the following example: > > Animal { > long id, > float weight, > float speed > } > > JungleAnimal extends Animal { > List<Animal> breakfast; > } > > Lion extends JungleAnimal { > boolean isMale > } > > So we have a simple class hierarchy, everything works with GAE (I have > simplified code above and it turned out to not be Java anymore) - > Animal implements Serializable, it is annotated with > @PersistenceCapable, all fields have @Persistent, etc. > > So, now that I have this basic framework, I write an insert method for > Lion and this method will write all the fields inherited from > hierarchy. > > The question is, did anybody think about having some DAOs for each > class, and each of them being concerned with the fields from that > class alone (and calling additional DAOs as the fields need to be > persisted up in the hierarchy)? Is that even possible? > > Thanks, I hope everything is clear. I would really appreciate your > opinion on this matter, > Alex > > -- > > 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]<google-appengine-java%[email protected]> > . > For more options, visit this group at > http://groups.google.com/group/google-appengine-java?hl=en. > > > -- Ikai Lan Developer Programs Engineer, Google App Engine -- 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.
