diff --git a/hibernate-core/src/main/java/org/hibernate/persister/entity/JoinedSubclassEntityPersister.java b/hibernate-core/src/main/java/org/hibernate/persister/entity/JoinedSubclassEntityPersister.java index bf6d33d72b..0f0333153d 100644 --- a/hibernate-core/src/main/java/org/hibernate/persister/entity/JoinedSubclassEntityPersister.java +++ b/hibernate-core/src/main/java/org/hibernate/persister/entity/JoinedSubclassEntityPersister.java @@ -1236,20 +1236,23 @@ public class JoinedSubclassEntityPersister extends AbstractEntityPersister { @Override public EntityDiscriminatorMapping getDiscriminatorMapping(TableGroup tableGroup) { - if ( explicitDiscriminatorColumnName == null ) { - CaseSearchedExpressionInfo info = getCaseSearchedExpression( tableGroup ); - return new JoinedSubclassDiscriminatorMappingImpl( - this, - getRootTableName(), - getDiscriminatorColumnName(), - info.caseSearchedExpression, - info.columnReferences, - (BasicType) getDiscriminatorType() - ); - } - else { - return super.getDiscriminatorMapping( tableGroup ); + if(hasSubclasses()) { + if ( explicitDiscriminatorColumnName == null ) { + CaseSearchedExpressionInfo info = getCaseSearchedExpression( tableGroup ); + return new JoinedSubclassDiscriminatorMappingImpl( + this, + getRootTableName(), + getDiscriminatorColumnName(), + info.caseSearchedExpression, + info.columnReferences, + (BasicType) getDiscriminatorType() + ); + } + else { + return super.getDiscriminatorMapping( tableGroup ); + } } + return null; } @Override