* This method is used when computing the nested queries for joined mappings.
* It recurses computing the nested mapping queries and their join indexes.
*/
protected void computeNestedQueriesForJoinedExpressions(List joinedExpressions, AbstractSession session, ObjectLevelReadQuery readQuery) {
for (int index = 0; index < joinedExpressions.size(); index++) {
ObjectExpression objectExpression = (ObjectExpression)joinedExpressions.get(index);
// Expression may not have been initialized.
objectExpression.getBuilder().setSession(session.getRootSession(null));
if (objectExpression.getBuilder().getQueryClass() == null){
objectExpression.getBuilder().setQueryClass(descriptor.getJavaClass());
}
// PERF: Cache join attribute names.
ObjectExpression baseExpression = objectExpression;
while (!baseExpression.getBaseExpression().isExpressionBuilder()) {
baseExpression = (ObjectExpression)((QueryKeyExpression)baseExpression).getBaseExpression();
}
this.addJoinedAttribute(baseExpression.getName());
// Ignore nested
if ((objectExpression.getBaseExpression() == objectExpression.getBuilder()) && objectExpression.getMapping().isForeignReferenceMapping()) {
ForeignReferenceMapping mapping = (ForeignReferenceMapping)objectExpression.getMapping();