HHH-7738 Allow @Inheritance on subclasses

This commit is contained in:
brmeyer 2012-10-30 15:28:42 -04:00
parent 70221d8ac2
commit 0a639fd712
1 changed files with 8 additions and 4 deletions

View File

@ -38,9 +38,12 @@ import org.jboss.jandex.DotName;
import org.jboss.jandex.FieldInfo; import org.jboss.jandex.FieldInfo;
import org.jboss.jandex.IndexView; import org.jboss.jandex.IndexView;
import org.jboss.jandex.MethodInfo; import org.jboss.jandex.MethodInfo;
import org.jboss.logging.Logger;
import org.hibernate.AnnotationException; import org.hibernate.AnnotationException;
import org.hibernate.internal.CoreMessageLogger;
import org.hibernate.internal.util.collections.CollectionHelper; import org.hibernate.internal.util.collections.CollectionHelper;
import org.hibernate.metamodel.internal.Binder;
import org.hibernate.metamodel.internal.source.annotations.AnnotationBindingContext; import org.hibernate.metamodel.internal.source.annotations.AnnotationBindingContext;
import org.hibernate.metamodel.internal.source.annotations.EntityHierarchyImpl; import org.hibernate.metamodel.internal.source.annotations.EntityHierarchyImpl;
import org.hibernate.metamodel.internal.source.annotations.RootEntitySourceImpl; import org.hibernate.metamodel.internal.source.annotations.RootEntitySourceImpl;
@ -59,6 +62,8 @@ import org.hibernate.metamodel.spi.source.SubclassEntitySource;
* @author Hardy Ferentschik * @author Hardy Ferentschik
*/ */
public class EntityHierarchyBuilder { public class EntityHierarchyBuilder {
private static final Logger LOG = Logger.getLogger(
EntityHierarchyBuilder.class);
private static final DotName OBJECT = DotName.createSimple( Object.class.getName() ); private static final DotName OBJECT = DotName.createSimple( Object.class.getName() );
/** /**
@ -421,11 +426,10 @@ public class EntityHierarchyBuilder {
info, JPADotNames.INHERITANCE info, JPADotNames.INHERITANCE
); );
if ( inheritanceAnnotation != null ) { if ( inheritanceAnnotation != null ) {
// if ( inheritanceAnnotation != null && !inheritanceAnnotation.value( "strategy" ).asString().equals( inheritanceType.toString() ) ) { LOG.warn(
throw new AnnotationException(
String.format( String.format(
"The inheritance type for %s must be specified on the root entity %s", "The inheritance type for %s should be specified only on the root entity %s. Ignoring...",
hierarchyListString( classes ), info.name(),
rootClassInfo.name().toString() rootClassInfo.name().toString()
) )
); );