title: Combining @Embeddable with @MappedSuperclass in one entity in JPA (EclipseLink)
body: <p>After switching to EclipseLink 2.6.0 (from 2.5.2), for a domain class declared with</p>
  
  <pre><code>@MappedSuperclass
  @Embeddable
  public class ADomainClass { ... }
  </code></pre>
  
  <p>I get an error:</p>
  
  <pre><code>Caused by: Exception [EclipseLink-28018] (Eclipse Persistence Services - 2.6.0.v20150309-bf26070): org.eclipse.persistence.exceptions.EntityManagerSetupException
  Exception Description: Predeployment of PersistenceUnit [default] failed.
  Internal Exception: java.lang.ClassCastException: org.eclipse.persistence.internal.jpa.metamodel.EmbeddableTypeImpl cannot be cast to org.eclipse.persistence.internal.jpa.metamodel.MappedSuperclassTypeImpl
      at org.eclipse.persistence.exceptions.EntityManagerSetupException.predeployFailed(EntityManagerSetupException.java:231)
      ... 73 more
  Caused by: java.lang.ClassCastException: org.eclipse.persistence.internal.jpa.metamodel.EmbeddableTypeImpl cannot be cast to org.eclipse.persistence.internal.jpa.metamodel.MappedSuperclassTypeImpl
      at org.eclipse.persistence.internal.jpa.metamodel.MetamodelImpl.preInitialize(MetamodelImpl.java:398)
      at org.eclipse.persistence.internal.jpa.metamodel.MetamodelImpl.&lt;init&gt;(MetamodelImpl.java:113)
      at org.eclipse.persistence.internal.jpa.metamodel.MetamodelImpl.&lt;init&gt;(MetamodelImpl.java:132)
      at org.eclipse.persistence.internal.jpa.EntityManagerSetupImpl.preInitializeMetamodel(EntityManagerSetupImpl.java:3755)
      at org.eclipse.persistence.internal.jpa.EntityManagerSetupImpl.predeploy(EntityManagerSetupImpl.java:2000)
      ... 71 more
  </code></pre>
  
  <p>Is it possible this is an unwanted regression in this new version of EclipseLink?</p>
  
  <p>(Note that when I look at the <code>ClassCastException</code> I can see in the same stack frame, it is caused by my class <code>ADomainClass</code>.)</p>
  
  <p><strong>EDIT:</strong></p>
  
  <p>My use case is an inheritance between <em>Embeddables</em>. <br/>My superclass <code>ADomainClass</code> (which is <code>@Embeddable</code>) and is extended by another <code>@Embeddable</code> class <code>ASubtype</code> does not work, unless the superclass is annotated with <code>@MappedSuperclass</code>.</p>
  
  <p>According to <a href="http://en.wikibooks.org/wiki/Java_Persistence/Embeddables#Inheritance" rel="nofollow">http://en.wikibooks.org/wiki/Java_Persistence/Embeddables#Inheritance</a>, <em>EclipseLink</em> / <em>Toplink</em> supports this JPA non-standard feature. Though one should achieve it with <code>DescriptorCustomizer</code> and the <code>InheritancePolicy</code>. (And not with <code>@MappedSuperclass</code>?)</p>