Again, my apologies for being so late to respond to this thread. There are many good questions here, and I'm going to try to respond to them in the order they were posted.
To this first question, my answer is: yes, when you want to update an object you should first read it from the datastore, update it, then write it back to the datastore. The GAE datastore is optimized to be very fast when reading, especially when doing key-based lookups as in your example. (In general, when designing applications for GAE you should keep in mind that it's optimized for reading, which means writes are relatively expensive. You should design your applications to minimize datastore writes. Having said that, I've implemented a write-behind cache that greatly reduces the performance impact of datastore writes, which will be added to OpenBD/GAE soon). The other issue to keep in mind is that when you write a CFC instance to the datastore, the complete object gets written, overwriting everything that was previously in the datastore. So if you have a CFC instance with multiple properties and you just want to update one property leaving the others unmodified, the only way to do it is via read-update-write. Vince On Fri, Nov 13, 2009 at 7:14 PM, Rainer <[email protected]> wrote: > > Guys, > > Maybe I can't find it in the GoogleAppEngine:Datastore documentation, > but I was wondering how I can update an object in the GAE datastore? > > For instance: > > I create an object from my Country component with CreateObject, give > all properties a value, and use 'googleKey = googleWrite(object)' to > store it in de datastore. > > Next request, I submit new property values + googleKey. What should I > do: > > 1) object = GoogleRead( googleKey), update values of object with form > values, and than googleWrite(object) ? > > OR > > 2) object = CreateObject().init(form), and than something like > googleWrite(object,"form.googleKey") ? > > In other words: must I first do a read from the datastore to update an > object in there? Isn't that a performance issue? > > Rainer. > > -- Open BlueDragon Public Mailing List http://www.openbluedragon.org/ http://twitter.com/OpenBlueDragon mailing list - http://groups.google.com/group/openbd?hl=en !! save a network - please trim replies before posting !!
