HHH-7622: Added check for invalid extensions of an entity class when building the entity hierarchies

This commit is contained in:
John Verhaeg 2012-09-19 08:13:18 -05:00
parent 4d0f01614a
commit 386a7c2f0d
2 changed files with 10 additions and 1 deletions

View File

@ -236,6 +236,15 @@ private static void processHierarchy(AnnotationBindingContext bindingContext,
}
for ( ClassInfo subClassInfo : subClasses ) {
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;
}
addSubClassToSubclassMap( classInfo.name(), subClassInfo, classToDirectSubclassMap );
processHierarchy(
bindingContext,

View File

@ -22,7 +22,7 @@
* @author Hardy Ferentschik
*/
@Embeddable
public class Closet extends Furniture {
public class Closet extends Woody {
int numberOfDoors;
}