aliases.getCollectionTableAlias(),
aliases.getEntityElementColumnAliases()
);
aliasResolutionContext.registerQuerySpaceAliases( fetch.getQuerySpaceUid(), entityReferenceAliases );
readerCollector.add(
new EntityReferenceInitializerImpl(
(EntityReference) fetch.getElementGraph(),
entityReferenceAliases
)
);
}
else {
// select the "collection columns"
selectStatementBuilder.appendSelectClauseFragment(
queryableCollection.selectFragment(
aliases.getElementTableAlias(),
aliases.getCollectionColumnAliases().getSuffix()
)
);
if ( fetch.getCollectionPersister().isOneToMany() ) {
// if the collection elements are entities, select the entity columns as well
final OuterJoinLoadable elementPersister = (OuterJoinLoadable) queryableCollection.getElementPersister();
selectStatementBuilder.appendSelectClauseFragment(
elementPersister.selectFragment(
aliases.getElementTableAlias(),
aliases.getEntityElementColumnAliases().getSuffix()
)
);
final EntityReferenceAliases entityReferenceAliases = new EntityReferenceAliasesImpl(
aliases.getElementTableAlias(),
aliases.getEntityElementColumnAliases()
);
aliasResolutionContext.registerQuerySpaceAliases( fetch.getQuerySpaceUid(), entityReferenceAliases );
readerCollector.add(
new EntityReferenceInitializerImpl(
(EntityReference) fetch.getElementGraph(),
entityReferenceAliases
)
);
}