title: JPA - Eclipselink - InheritanceType.JOINED not doing the correct JOIN
body: <p>I dont know if this is a bug or there is something I am missing, but there is a problem when you try to use Inheritance.JOINED when the superclass has a composite primary key.</p>
  <p>I have the following classes:
  (Superclass)</p>
  <pre><code>@Entity
  @Table(name = &quot;tipos_opciones_misiones&quot;)
  @IdClass(TipoOpcionMisionId.class)
  @Inheritance(strategy = InheritanceType.JOINED)
  @DiscriminatorColumn(name = &quot;clase&quot;, discriminatorType = DiscriminatorType.STRING)
  @ReadOnly
  public abstract class TipoOpcionMision{
      @Id
      @ManyToOne
      @JoinColumn(name=&quot;tipo_mision&quot;)
      private TipoMision tipoMision;
  
      @Id
      @Column(name = &quot;numero&quot;)
      private int numero;
  }
  </code></pre>
  <p>And a child class:</p>
  <pre><code>@Entity
  @Table(name=&quot;tipos_misiones_opciones_comercio_compra&quot;)
  @DiscriminatorValue(&quot;COMERCIO_COMPRA&quot;)
  public class TipoOpcionMisionComercioCompra extends TipoOpcionMision{
  
      @Column(name=&quot;valor&quot;)
      double valor;
  }
  </code></pre>
  <p>When I try to get a list on objects &quot;TipoOpcionMision&quot; the generated SQL ignores that there is a composite key [tipo_mision, numero] and it just uses &quot;t1.numero = t0.numero&quot;. There should also be a &quot;t1.tipo_mision= t0.tipo_mision&quot;.</p>
  <pre><code>SELECT **list of fields***,  FROM tipos_misiones_opciones t0, tipos_misiones_opciones_comercio_compra t1 WHERE ((t0.tipo_mision = 'MISION_1') AND ((t1.numero = t0.numero) AND (t0.clase = 'COMERCIO_COMPRA')))
  </code></pre>
  <p>There is no errors, but I get false results because I am getting the values of the first row in the cartesian product.</p>
  <p>I have tried to add:</p>
  <pre><code>@PrimaryKeyJoinColumns({
          @PrimaryKeyJoinColumn(name = &quot;tipo_mision&quot;, referencedColumnName = &quot;tipo_mision&quot;),
          @PrimaryKeyJoinColumn(name = &quot;numero&quot;, referencedColumnName = &quot;numero&quot;)
  })  
  </code></pre>
  <p>But program fails when starting with the following error:</p>
  <pre><code>Exception Description: A @PrimaryKeyJoinColumns was found on the annotated element [class TipoOpcionMisionComercioCompra]. When the entity uses a single primary key, only a single (or zero) @PrimaryKeyJoinColumn should be specified.
  </code></pre>
  <p>It seems that for some reason Eclipselink is ignoring tthat the superclass has a composite primary key.</p>