title: How to set a backreference from an @EmbeddedId in JPA
body: <p>Does someone know if it is possible to establish a backreference from within a JPA <code>@EmbeddedId</code>. </p>
  
  <p>So for example there is an Entity of the Form</p>
  
  <p></p>
  
  <pre><code>@Entity
  public class Entity1 {
      @Id
      @GeneratedValue
      private String identifier;
  
      private Entity1 relationToEntity1;
      //Left out the getters and setters for simplicity
  }
  </code></pre>
  
  <p></p>
  
  <p>And a second entity with a complex embedded Id. One part of this second entity is a reference to its parent entity. Like so:</p>
  
  <p></p>
  
  <pre><code>@Entity
  public class Entity2 {
      @EmbeddedId private Entity2Identifier id;
      //Left out the getters and setters for simplicity.
  }
  
  @Embedabble
  public class Entity2Identifier {
      private String firstPartOfIdentifier;
      private Entity1 parent;
      //Left out the getters and setters for simplicity.
  }
  </code></pre>
  
  <p></p>
  
  <p>When I try to save such a construct via JPA (Implementation is EclipseLink) to a database I get several exceptions of the form:</p>
  
  <p><code></p>
  
  <pre><code>Exception [EclipseLink-93] (Eclipse Persistence Services - 1.1.0.r3639-SNAPSHOT): 
  org.eclipse.persistence.exceptions.DescriptorException
  Exception Description: The table [ENTITY1] is not present in this descriptor.
  Descriptor: RelationalDescriptor(test.Entity2 --&gt; [DatabaseTable(ENTITY2)])
  </code></pre>
  
  <p></code></p>
  
  <p>Did someone encounter such a problem and has a solution?</p>