title: Using String or Long for Google App Engine Datastore Key
body: <p>What is the difference of GAE datastore Long id and String key in <a href="https://developers.google.com/appengine/docs/java/javadoc/com/google/appengine/api/datastore/Key" rel="nofollow">Key</a>. </p>
  
  <p>Using the Key</p>
  
  <pre><code>KeyFactory.createKey(kind, key);
  
  KeyFactory.createKey(kind, id);
  </code></pre>
  
  <p>So in this case either can be used as Identifier. If I create a Key from <code>KeyFactory.createKey(kind, key)</code> where key is a String I can see the <code>id</code> field of the key is 0. In this case <code>getId()</code> will be <code>0</code>? And in contrast, if what is set is <code>KeyFactory.createKey(kind, someLongValue)</code> then <code>getName()</code> will be a empty <code>String</code>?</p>