* It iterates through a list of join expressions and adds an index that represents where the
* fields represented by that expression will appear in the row returned by a read query.
*/
protected int computeIndexesForJoinedExpressions(List joinedExpressions, int currentIndex, AbstractSession session) {
for (int index = 0; index < joinedExpressions.size(); index++) {
ObjectExpression objectExpression = (ObjectExpression)joinedExpressions.get(index);
DatabaseMapping mapping = objectExpression.getMapping();
// Ignore nested
if ((objectExpression.getBaseExpression() == objectExpression.getBuilder()) && (mapping != null) && mapping.isForeignReferenceMapping()) {
getJoinedMappingIndexes_().put(mapping, new Integer(currentIndex));
}
ClassDescriptor descriptor = mapping.getReferenceDescriptor();
int numberOfFields = 0;
if (descriptor == null) {
// Direct-collection mappings do not have descriptor.
if (mapping.isDirectCollectionMapping()) {
numberOfFields = 1;
} else if (mapping.isDirectMapMapping()) {
numberOfFields = 2;
}
} else if (objectExpression.isQueryKeyExpression() && objectExpression.isUsingOuterJoinForMultitableInheritance()) {
numberOfFields = descriptor.getAllFields().size();
} else {
numberOfFields = descriptor.getFields().size();
}
currentIndex = currentIndex + numberOfFields;