There are two distinctions to be made - do your properties change dynamically with program code or do they just evolve rapidly over time? Ie: Do you need a dynamic interface to properties (Map<String,Object>) or do you just need a more flexible way to deal with schema evolution?
For a fully dynamic interface, go directly to the Low-Level API. The Entity object is basically a hashmap and you can get/set any properties you want. You can iterate through the available properties. For basic schema evolution, you have more choices. JDO is particularly bad at this. Pretty much any change in the underlying schema will break your application. Objectify is particularly good at this. Possibly the other alternative datastore APIs can help too (Twig, SimpleDS, Slim3) but I don't know. You can read a lot more about Objectify's tools for schema migration here: http://code.google.com/p/objectify-appengine/wiki/IntroductionToObjectify#Migrating_Schemas Basically, you can add or remove fields to your entities at any time without any ill effects. You can also create mappings so that you can change your entity classes, loading the old schema into the new entities and upgrading them on the fly. This lets you make some fairly extensive schema changes with zero downtime. Note that this still isn't a wholly generic Map interface to the datastore; you are still working with your typed Java classes. But you can use both the Low-Level API and Objectify together very well; the data structures have an intuitive 1-to-1 mapping. Here's the project: http://code.google.com/p/objectify-appengine/ Good luck, Jeff 2010/6/1 Víctor Mayoral <[email protected]>: > Hey Tristan! > > Thanks for your answer. I will check the docs again and take a look at > the low level API. The notification + trigger method seems pretty > intelligent i will also check that too. > But I was just wondering, isn't there something like a framework for > this types of jobs?. > > Again, thanks > > Víctor. > > > On 2 jun, 00:41, Tristan <[email protected]> wrote: >> Not sure how it would work in JDO but its simple to add properties in >> low-level datastore. >> >> I store my entities with a version property, when I update the entity, >> I change the version and change my code to either intialize a non- >> existing property on an old entity, or to delete a deprecated >> property. This happens lazily (only when the entity is actally used). >> You can also include a counter of how many entities were updated from >> old to new and have a flag trigger when 100% of updates are complete. >> Then in the next version of the code you can remove the updating >> method since all old entities were lazily updated. An alternative >> would be to set notification at 90% or some other percentage, and then >> trigger a task that cleans up the rest of the entities. I use this >> approach to keep my data consistent without the need for hugely >> intensive datastore scans to update when changes happen. >> >> Hope this will give you some ideas. >> >> Cheers! >> >> Tristan >> >> On Jun 1, 6:28 am, Víctor Mayoral <[email protected]> wrote: >> >> >> >> > Hello, >> > I've just an applications using GWT and GAE. After reading the docs >> > and doing some examples I decided to begin coding but soon I reach >> > something tricky. >> >> > My application data would be at the GAE datastore using JDO. I want to >> > assume >> > that the app "will live". Let me explain this: >> > The entities at the datastore will change. This means that some >> > properties would be added and some of them maybe removed what leaves >> > me with a ton of exceptions to handle. Knowing this, which should be >> > the way to update the datastore entities? One by one after a change >> > is >> > made? Should I handle exceptions and then change just the entitie >> > requested? Is there a way to do this cleaner? >> >> > I've been thinking about how to do this stuff with my actual >> > knowledge >> > and i think that the most logical way to proceed is get the object, >> > remove it from the database, create a new one based on this old >> > object >> > and then persist it again. >> >> > To sum up the question is about if there's a way to add a property to >> > an stored entitie in the datastore (GAE) easily. >> >> > I hope you to understand my lines. Any suggestion would be >> > appreciated. >> >> > Thanks, >> >> > Víctor. > > -- > You received this message because you are subscribed to the Google Groups > "Google App Engine" 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?hl=en. > > -- You received this message because you are subscribed to the Google Groups "Google App Engine" 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?hl=en.
