ClassDescriptor descriptor = getDescriptor();
InheritancePolicy policy = descriptor.getInheritancePolicy();
// The onlyInstances expression is only included on leaf descriptor base select,
// so if a root or branch (!shouldReadSubclasses means leaf), then it must be appended.
if (policy.shouldReadSubclasses()) {
Expression indicatorExpression = null;
// If the descriptor is a single table branch, then select the whole branch in a single query.
if (this.query.isReadAllQuery() && policy.hasChildren() && !policy.hasMultipleTableChild()) {
indicatorExpression = policy.getWithAllSubclassesExpression();
} else {