[hibernate-dev] can a mapped super class extends from an entity?

Strong Liu stliu at hibernate.org
Tue Apr 2 01:11:59 EDT 2013


test is org.hibernate.jpa.test.metadata.MetadataTest and root class is org.hibernate.jpa.test.metadata.Thing

basically here is a hierarchy like :


Entity ->  MappedSuperclass -> Entity -> MappedSuperclass -> Object (//not an entity but in between mapped superclass and entity) -> MappedSuperclass

in the metamodel branch org.hibernate.metamodel.internal.source.annotations.util.EntityHierarchyBuilder#processHierarchy

if ( !isEntityClass( 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 );
				}
				continue;
			}

-------------------------
Best Regards,

Strong Liu <stliu at hibernate.org>
http://about.me/stliu/bio





More information about the hibernate-dev mailing list