On Wed, Feb 5, 2014 at 10:35 AM, Juan de Dios Becerra < [email protected]> wrote: > > I have not found a good example of how to update datastore, so I am doing > manually delete the entities and then insert again I know is completely > awful for this reason I think it could be a better way, there exists? Btw I > am using Java. >
Hi Juan, In the App Engine datastore, an update operation is the same as an insert operation; if you insert an entity with the same Kind and ID/Name as a currently existing entity, the pre-existing entity will be overwritten with information from the new entity. Also, the indexes will be automatically updated to reflect the new values. So you can simply reuse the code that is currently doing the entity insertion. Just remember to set the same Kind and ID/Name as the entity you want to overwrite. If you don't know the current IDs in use, you can query for the entities and extract the IDs. ----------------- -Vinny P Technology & Media Advisor Chicago, IL App Engine Code Samples: http://www.learntogoogleit.com -- You received this message because you are subscribed to the Google Groups "Google App Engine" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/google-appengine. For more options, visit https://groups.google.com/groups/opt_out.
