use of org.hibernate.sql.results.graph.collection.internal.EagerCollectionFetch in project hibernate-orm by hibernate.
the class PluralAttributeMappingImpl method generateFetch.
@Override
public Fetch generateFetch(FetchParent fetchParent, NavigablePath fetchablePath, FetchTiming fetchTiming, boolean selected, String resultVariable, DomainResultCreationState creationState) {
final SqlAstCreationState sqlAstCreationState = creationState.getSqlAstCreationState();
final boolean added = creationState.registerVisitedAssociationKey(fkDescriptor.getAssociationKey());
try {
if (fetchTiming == FetchTiming.IMMEDIATE) {
if (selected) {
final TableGroup collectionTableGroup = resolveCollectionTableGroup(fetchParent, fetchablePath, creationState, sqlAstCreationState);
return new EagerCollectionFetch(fetchablePath, this, collectionTableGroup, fetchParent, creationState);
} else {
return createSelectEagerCollectionFetch(fetchParent, fetchablePath, creationState, sqlAstCreationState);
}
}
if (getCollectionDescriptor().getCollectionType().hasHolder()) {
return createSelectEagerCollectionFetch(fetchParent, fetchablePath, creationState, sqlAstCreationState);
}
return createDelayedCollectionFetch(fetchParent, fetchablePath, creationState, sqlAstCreationState);
} finally {
// and on top of this, we are not handling circular fetches for plural attributes yet
if (added) {
creationState.removeVisitedAssociationKey(fkDescriptor.getAssociationKey());
}
}
}
use of org.hibernate.sql.results.graph.collection.internal.EagerCollectionFetch in project hibernate-orm by hibernate.
the class ScrollableResultsConsumer method containsCollectionFetches.
private boolean containsCollectionFetches(JdbcValuesMapping valuesMapping) {
final List<DomainResult<?>> domainResults = valuesMapping.getDomainResults();
for (DomainResult domainResult : domainResults) {
if (domainResult instanceof EntityResult) {
EntityResult entityResult = (EntityResult) domainResult;
final List<Fetch> fetches = entityResult.getFetches();
for (Fetch fetch : fetches) {
if (fetch instanceof EagerCollectionFetch) {
return true;
}
}
}
}
return false;
}
Aggregations