diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/annotations/util/EntityHierarchyBuilder.java b/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/annotations/util/EntityHierarchyBuilder.java index 8b874e6b1c..170801d635 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/annotations/util/EntityHierarchyBuilder.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/annotations/util/EntityHierarchyBuilder.java @@ -267,7 +267,7 @@ public class EntityHierarchyBuilder { for ( ClassInfo subClassInfo : subClasses ) { if ( !isEntityClass( subClassInfo ) ) { - MappingAssertion.assertSubEntityIsNotEmbeddableNorMappedSuperclass( subClassInfo ); + MappingAssertion.assertSubEntityIsNotEmbeddable( subClassInfo ); continue; } addSubClassToSubclassMap( classInfo.name(), subClassInfo, classToDirectSubclassMap ); diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/annotations/util/MappingAssertion.java b/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/annotations/util/MappingAssertion.java index 8363960517..60e078067a 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/annotations/util/MappingAssertion.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/annotations/util/MappingAssertion.java @@ -69,18 +69,14 @@ public class MappingAssertion { /** - * Check if the sub-entity has {@link javax.persistence.Embeddable @Embeddable} or {@link javax.persistence.MappedSuperclass @MappedSuperclass}. - * - * From the JPA Spec, a sub entity class can not has such annotation. + * Check if the sub-entity has {@link javax.persistence.Embeddable @Embeddable}. From the JPA Spec, + * a sub entity class can not has such annotation. * * @param subClassInfo The sub entity {@link ClassInfo class}. */ - static void assertSubEntityIsNotEmbeddableNorMappedSuperclass(ClassInfo subClassInfo) { + static void assertSubEntityIsNotEmbeddable(ClassInfo subClassInfo) { if ( JandexHelper.containsSingleAnnotation( subClassInfo, JPADotNames.EMBEDDABLE ) ) { throw new AnnotationException( "An embeddable cannot extend an entity: " + subClassInfo ); } - if ( JandexHelper.containsSingleAnnotation( subClassInfo, JPADotNames.MAPPED_SUPERCLASS ) ) { - throw new AnnotationException( "A mapped superclass cannot extend an entity: " + subClassInfo ); - } } } diff --git a/hibernate-core/src/test/java/org/hibernate/test/annotations/polymorphism/PolymorphismTest.java b/hibernate-core/src/test/java/org/hibernate/test/annotations/polymorphism/PolymorphismTest.java index 408af013d6..e80b9fc7d8 100644 --- a/hibernate-core/src/test/java/org/hibernate/test/annotations/polymorphism/PolymorphismTest.java +++ b/hibernate-core/src/test/java/org/hibernate/test/annotations/polymorphism/PolymorphismTest.java @@ -23,24 +23,23 @@ */ package org.hibernate.test.annotations.polymorphism; -import org.junit.Test; +import static org.junit.Assert.assertEquals; import org.hibernate.Session; import org.hibernate.Transaction; import org.hibernate.testing.FailureExpectedWithNewMetamodel; import org.hibernate.testing.TestForIssue; import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase; - -import static org.junit.Assert.assertEquals; +import org.junit.Test; /** * @author Emmanuel Bernard * @author Brett Meyer */ -@FailureExpectedWithNewMetamodel public class PolymorphismTest extends BaseCoreFunctionalTestCase { @Test + @FailureExpectedWithNewMetamodel public void testPolymorphism() throws Exception { Car car = new Car(); car.setModel( "SUV" );