On Mon, Aug 1, 2011 at 10:22 AM, Tim <meer...@gmail.com> wrote:
>
> [(*) - Stephen's making the point that I can simply allocate one range of
> IDs and use these for new Garages or new Vehicles as appropriate. I
> appreciate the info, and if I had hundreds of types of objects then I may
> look at that, but for now I'm happy to allocate a range for each type]


Even though you're allocating from two ranges rather than one, that's
still less than the datastore would do things automatically, so you
still have to be careful.

For example, suppose you later add an admin web interface that can
also create new cars and add them to garages. If you let the datastore
allocate IDs, the first car you add to any garage through this new
code path will get ID 1 or thereabouts, because children get an ID
from the range associated with their parent. Eventually the
admin-generated car IDs may clash with those pre-allocated from the
global car sequence given out to remote clients, and old data will be
over written.

So you might want to enforce that a Car model can't be created without
passing in an ID.

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To post to this group, send email to google-appengine@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en.

Reply via email to