if (!sel && asc == null)
return 0;
// if this mapping can't select the full pk values, then join to
// super and recurse
ClassMapping sup;
if (!mapping.isPrimaryKeyObjectId(true)) {
sup = mapping.getJoinablePCSuperclassMapping();
if (joins == null)
joins = newJoins();
joins = mapping.joinSuperclass(joins, false);
return primaryKeyOperation(sup, sel, asc, joins, aliasOrder);
}
Column[] cols = mapping.getPrimaryKeyColumns();
if (isGrouping()) {
groupBy(cols, joins);
return 0;
}
PathJoins pj = getJoins(joins, false);
int seld = 0;
for (int i = 0; i < cols.length; i++)
if (columnOperation(cols[i], sel, asc, pj, aliasOrder))
seld |= 2 << i;
// if this mapping has not been used in the select yet (and therefore
// is not joined to anything), but has an other-table superclass that
// has been used, make sure to join to it
boolean joined = false;
for (sup = mapping.getJoinablePCSuperclassMapping(); sup != null;
mapping = sup, sup = mapping.getJoinablePCSuperclassMapping()) {
if (sup.getTable() == mapping.getTable())
continue;
if (mapping.getTable() != sup.getTable()
&& getTableIndex(mapping.getTable(), pj, false) == -1
&& getTableIndex(sup.getTable(), pj, false) != -1) {
if (pj == null)
pj = (PathJoins) newJoins();
pj = (PathJoins) mapping.joinSuperclass(pj, false);
joined = true;
} else