Fix select child of joinsubclass inheritance

This commit is contained in:
Andrea Boriero 2020-07-16 17:42:06 +01:00
parent b06be7ff6d
commit 3ba826e1c8
1 changed files with 16 additions and 13 deletions

View File

@ -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