title: Best way to store a class in Google datastore
body: <p>I want to design a database to where I would store objects that are instances of different classes but are extended from one common class. Along with the object, I would store key that will be used to identify the object. The relationship between key-object is N-1 unidirectional(key -> object).</p>
  
  <p>I thought of using Google App Engine's datastore to create two entities(ObjectEntity and KeyEntity).</p>
  
  <pre><code>@PersistenceCapable(identityType = IdentityType.APPLICATION)
  public class KeyEntity{
   @PrimaryKey
   @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
   private Key id;
   @Persistent
   private String keyForObject;
   @Persistent
   private ObjectEntity object;
  
   //setters and getters
  }
  
  @PersistenceCapable(identityType = IdentityType.APPLICATION)
  public class ObjectEntity{
   @PrimaryKey
   @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
   private Key id;
   @Persistent
   private String objectName;
   @Persistent
   private CommonParentClass object;
  
   //setters and getters
  }
  </code></pre>
  
  <p>Is this the right way or is there a better way to store objects?</p>