if (getQuery().isReportQuery()) {
SQLSelectStatement statement = buildReportQuerySelectStatement(false);
setSQLStatement(statement);
// For bug 2718118 inheritance with cursors is supported provided there is a read all subclasses view.
} else if (getDescriptor().hasInheritance() && getDescriptor().getInheritancePolicy().requiresMultipleTableSubclassRead() && getDescriptor().getInheritancePolicy().hasView()) {
InheritancePolicy inheritancePolicy = getDescriptor().getInheritancePolicy();
SQLSelectStatement statement = inheritancePolicy.buildViewSelectStatement((ObjectLevelReadQuery)getQuery());
setSQLStatement(statement);
} else {
setSQLStatement(buildNormalSelectStatement());
}