title: Is this valid JPA/Hibernate mapping?
body: <p>Today I discovered something strange. If I run this code with <code>-ea</code> flag. It will fail. Is there anything wrong? This is working fine without <code>-ea</code>. But the test environment requires <code>-ea</code> flag.</p>
  <p>This is the exception I get when run with <code>-ea</code> flag:</p>
  <pre><code>Caused by: java.lang.AssertionError: null
      at org.hibernate.cfg.InheritanceState.getElementsToProcess(InheritanceState.java:206) ~[hibernate-core-5.6.1.Final.jar:5.6.1.Final]
      at org.hibernate.cfg.InheritanceState.hasIdClassOrEmbeddedId(InheritanceState.java:185) ~[hibernate-core-5.6.1.Final.jar:5.6.1.Final]
      at org.hibernate.cfg.AnnotationBinder.processElementAnnotations(AnnotationBinder.java:2262) ~[hibernate-core-5.6.1.Final.jar:5.6.1.Final]
      at org.hibernate.cfg.AnnotationBinder.fillComponent(AnnotationBinder.java:2825) ~[hibernate-core-5.6.1.Final.jar:5.6.1.Final]
      at org.hibernate.cfg.AnnotationBinder.bindIdClass(AnnotationBinder.java:2928) ~[hibernate-core-5.6.1.Final.jar:5.6.1.Final]
      at org.hibernate.cfg.AnnotationBinder.mapAsIdClass(AnnotationBinder.java:1066) ~[hibernate-core-5.6.1.Final.jar:5.6.1.Final]
      at org.hibernate.cfg.AnnotationBinder.bindClass(AnnotationBinder.java:792) ~[hibernate-core-5.6.1.Final.jar:5.6.1.Final]
      at org.hibernate.boot.model.source.internal.annotations.AnnotationMetadataSourceProcessorImpl.processEntityHierarchies(AnnotationMetadataSourceProcessorImpl.java:225) ~[hibernate-core-5.6.1.Final.jar:5.6.1.Final]
  </code></pre>
  <p>This is minimal trimmed down spring-boot app:</p>
  <pre class="lang-java prettyprint-override"><code>import org.springframework.boot.SpringApplication;
  import org.springframework.boot.autoconfigure.SpringBootApplication;
  
  import javax.persistence.*;
  import java.io.Serializable;
  
  @SpringBootApplication
  public class DemoHibernateTestApplication {
  
      @Entity
      public static class Product {
  
          @Id
          private Long id;
  
      }
  
      @MappedSuperclass
      public static abstract class ProductOrder {
  
          @Id
          private Long id;
  
      }
  
      @Entity
      public static class ProductOrderSummary extends ProductOrder {
      }
  
      @Entity
      @IdClass(ProductOrderItem.PK.class)
      public static class ProductOrderItem {
  
          @Id
          @ManyToOne(targetEntity = ProductOrderSummary.class)
          private ProductOrder order;
  
          @Id
          @ManyToOne
          private Product product;
  
          public static class PK implements Serializable {
              private Long order;
              private Long product;
          }
      }
  
      public static void main(String[] args) {
          SpringApplication.run(DemoHibernateTestApplication.class, args);
      }
  }
  </code></pre>
  <p>Environment:
  Java17 x86, Linux, Hibernate-Core 5.6.1</p>