/** * Add on association (one-to-one, many-to-one, or a collection) to a list of associations to be * fetched by outerjoin */ private void addAssociationToJoinTree( final AssociationType type, final String[] aliasedLhsColumns, final String alias, final PropertyPath path, final int currentDepth, final JoinType joinType) throws MappingException { Joinable joinable = type.getAssociatedJoinable(getFactory()); // important to generate alias based on size of association collection // *before* adding this join to that collection String subalias = generateTableAlias(associations.size() + 1, path, joinable); // NOTE : it should be fine to continue to pass only filters below // (instead of LoadQueryInfluencers) since "from that point on" we // only need to worry about restrictions (and not say adding more // joins) OuterJoinableAssociation assoc = new OuterJoinableAssociation( path, type, alias, aliasedLhsColumns, subalias, joinType, getWithClause(path), hasRestriction(path), getFactory(), loadQueryInfluencers.getEnabledFilters()); assoc.validateJoin(path.getFullPath()); associations.add(assoc); int nextDepth = currentDepth + 1; // path = ""; if (!joinable.isCollection()) { if (joinable instanceof OuterJoinLoadable) { walkEntityTree((OuterJoinLoadable) joinable, subalias, path, nextDepth); } } else { if (joinable instanceof QueryableCollection) { walkCollectionTree((QueryableCollection) joinable, subalias, path, nextDepth); } } }