title: Get Parent Entity from Spring data Repository
body: <p>How can I get parent <code>Entity</code> object from <code>SubEntity</code> object.</p>
  
  <p><code>subEntityRepository.findById(id)</code> and then <code>getEntity()</code> return <code>null</code> entity object.</p>
  
  <pre><code>@Entity
  public class Entity {
      @Id
      private Long id;
      @Reference
      private List&lt;SubEntity&gt; subEntity;
  
  
      public Building(List&lt;SubEntity&gt; subEntity) {
          this.subEntity = subEntity;
      }
  
      //getters and setters
  }
  
  @Entity
  public class SubEntity {
      @Id
      private Long id;
  
      @Reference
      private Entity entity;
  
      //getters and setters
  }
  
  public interface EntityRepository extends DatastoreRepository&lt;Entity, Long&gt; {}
  
  
  public interface SubEntityRepository extends DatastoreRepository&lt;SubEntity, Long&gt;{}
  </code></pre>
  
  <p>P.S. This is Google DataStore DB! No OneToMany, no other JPA annotations is available.</p>