HHH-5125 Raise proper exception when @Entity and @MappedSuperclass are present on the same class
git-svn-id: https://svn.jboss.org/repos/hibernate/core/trunk@19241 1b8cb986-b30d-0410-93ca-fae66ebed9b2
This commit is contained in:
parent
5da56b7881
commit
422ecc653a
|
@ -504,6 +504,13 @@ public final class AnnotationBinder {
|
|||
public static void bindClass(
|
||||
XClass clazzToProcess, Map<XClass, InheritanceState> inheritanceStatePerClass, ExtendedMappings mappings
|
||||
) throws MappingException {
|
||||
//@Entity and @MappedSuperclass on the same class leads to a NPE down the road
|
||||
if ( clazzToProcess.isAnnotationPresent( Entity.class )
|
||||
&& clazzToProcess.isAnnotationPresent( MappedSuperclass.class ) ) {
|
||||
throw new AnnotationException( "An entity cannot be annotated with both @Entity and @MappedSuperclass: "
|
||||
+ clazzToProcess.getName() );
|
||||
}
|
||||
|
||||
//TODO: be more strict with secondarytable allowance (not for ids, not for secondary table join columns etc)
|
||||
InheritanceState inheritanceState = inheritanceStatePerClass.get( clazzToProcess );
|
||||
AnnotatedClassType classType = mappings.getClassType( clazzToProcess );
|
||||
|
|
Loading…
Reference in New Issue