Vince, thanks a lot for these insights. What is the difference between "completely replac[ing] an existing User object" and simply updating some or all of its property values? Are you referring to the structure (signature) of the cfc?
Baz On Wed, Nov 25, 2009 at 12:06 PM, Vince Bonfanti <[email protected]>wrote: > 1) You should do a read-update-write to update the User object (see my > previous message). > > 2) Again, I'd recommend doing a read-update-write to update the User > object. However, if you want to completely replace an existing User object > and you know the "kind" and "keyName", then you could create a new User > object and then do: > > GoogleWrite( User, kind, keyName ); > > This would have the effect of completely overwriting any existing User > object with the same kind/keyName. > > Vince > > > On Mon, Nov 16, 2009 at 4:18 AM, Rainer <[email protected]> wrote: > >> >> Vince, >> >> Coul you please clarify me on this subject, I don't get 'the circle >> closed'. >> >> When I follow the documentation at >> http://wiki.openbluedragon.org/wiki/index.php/GoogleAppEngine:Datastore, >> I can't seem to make a closing structure of my logic. >> >> 1) When I choose to go for the googleKey (which I higly prefer, >> because it's generated by the datastore), I do the following: >> - create an object from my User.cfc (bean); User = CreateObject >> ('component','model.user.User').init() >> - write it to the datastore; googleKey = GoogleWrite(User); >> - read from the datastore; User = googleRead(googleKey); >> - get list of users; aUsers = GoogleQuery('select from User') >> But what if I have a the details of a user in a form (with the >> googleKey in a hidden input), and I post this form. >> How do I than create a User object that 'knows' the googleKey so that >> a GoogleWrite() will update an exisiting object in the datastore? >> Should I first do a 'User = googleRead(googleKey)' and than update the >> properties with my form properties, and than 'GoogleWrite(User)'? >> Or can I set the googleKey in my User object with a 'setGoogleKey()' >> function, or something like that? >> >> 2) When I choose to go for the combination kind/keyName, I do the >> following: >> - create an object from my User.cfc (bean); User = CreateObject >> ('component','model.user.User').init(kind,keyName) >> - write it to the datastore; GoogleWrite(User,kind,keyName); >> - read from the datastore; User = googleRead(kind,keyName); >> - get list of users; aUsers = GoogleQuery('select from User'); >> But what if I have a the details of a user in a form (with the kind >> and keyName in a hidden input), and I post this form. >> How do I than create a User object that 'knows' the the kind and >> keyName so that a GoogleWrite() will update an exisiting object in the >> datastore? Should I first do a 'User = googleRead(kind,keyName)' and >> than update the properties with my form properties, and than >> 'GoogleWrite(User)'? >> Or can I set the kind and keyName in my User object with 'setGoogleKind >> () and setGoogleKeyName()' functions, or something like that? >> >> Maybe, I am overseeing something very badly, but after read the doc a >> couple of time, and trying some different code, I coul not come up >> with a solution. >> >> Thank you in advance for helping me out, >> >> 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 !! > -- 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 !!
