while (relationshipIt.hasNext() && pathIt.hasNext()) {
// relationship path components must be DbRelationships
DbRelationship nextDBR = (DbRelationship) relationshipIt.next();
// expression components may be attributes or relationships
CayenneMapEntry next = pathIt.next();
if (nextDBR != next) {
// found split point
// consume the last iteration components,
// then break out to finish the iterators independently
prependReversedPath(finalPath, nextDBR);
appendPath(finalPath, next);
break;
}
break;
}
// append remainder of the relationship, reversing it
while (relationshipIt.hasNext()) {
DbRelationship nextDBR = (DbRelationship) relationshipIt.next();
prependReversedPath(finalPath, nextDBR);
}
while (pathIt.hasNext()) {
// components may be attributes or relationships
CayenneMapEntry next = pathIt.next();
appendPath(finalPath, next);
}
return convertToPath(finalPath);
}