title: Please help me understand entity hierarchies in GAE's Datastore
body: <p>The Google App Engine Datastore allows each entity to have a <em>parent entity</em>, essentially a way to form an <em>entity hierarchy</em>.  For example, an <code>Employee</code> can be addressed as:</p>
  
  <pre><code>Company#521/Department#5/Employee#3
  </code></pre>
  
  <p>The entity id is only unique among entities with the same parent, so the full entity path is required to uniquely address it.</p>
  
  <p>So far, so good.</p>
  
  <p>But <em>when</em> should I model a parent-child relationship this way, rather than relying on a basic reference property within an entity, as I would in a traditional database?</p>
  
  <p>The only reason I can think of is to get around the lack of joins in a Datastore query.  I can only filter a query using properties from the entity whose kind I am retrieving -- and by any entity that is a parent at any level in the entity's hierarchy.</p>
  
  <p>Any other reason to use this feature?</p>
  
  <p>The Datastore documentation says that entities that belong to the same hierarchy are treated as an <em>entity group</em>, and that entities in the same entity group have serialized write access.  What exactly does that mean?  Does it mean that if one thread of my app is updating <code>Department#5</code>, another thread that is writing to <code>Employee#3</code> will have to wait for this update to finish?</p>
  
  <p>Thanks!</p>