use of org.hibernate.loader.plan.spi.CompositeFetch in project hibernate-orm by hibernate.
the class ReturnGraphTreePrinter method writeCollectionReferenceFetches.
private void writeCollectionReferenceFetches(CollectionReference collectionReference, int depth, PrintWriter printWriter) {
final CollectionFetchableIndex indexGraph = collectionReference.getIndexGraph();
if (indexGraph != null) {
printWriter.print(TreePrinterHelper.INSTANCE.generateNodePrefix(depth) + "(collection index) ");
if (EntityReference.class.isInstance(indexGraph)) {
final EntityReference indexGraphAsEntityReference = (EntityReference) indexGraph;
printWriter.println(extractDetails(indexGraphAsEntityReference));
writeEntityReferenceFetches(indexGraphAsEntityReference, depth + 1, printWriter);
} else if (CompositeFetch.class.isInstance(indexGraph)) {
final CompositeFetch indexGraphAsCompositeFetch = (CompositeFetch) indexGraph;
printWriter.println(extractDetails(indexGraphAsCompositeFetch));
writeCompositeFetchFetches(indexGraphAsCompositeFetch, depth + 1, printWriter);
}
}
final CollectionFetchableElement elementGraph = collectionReference.getElementGraph();
if (elementGraph != null) {
printWriter.print(TreePrinterHelper.INSTANCE.generateNodePrefix(depth) + "(collection element) ");
if (EntityReference.class.isInstance(elementGraph)) {
final EntityReference elementGraphAsEntityReference = (EntityReference) elementGraph;
printWriter.println(extractDetails(elementGraphAsEntityReference));
writeEntityReferenceFetches(elementGraphAsEntityReference, depth + 1, printWriter);
} else if (CompositeFetch.class.isInstance(elementGraph)) {
final CompositeFetch elementGraphAsCompositeFetch = (CompositeFetch) elementGraph;
printWriter.println(extractDetails(elementGraphAsCompositeFetch));
writeCompositeFetchFetches(elementGraphAsCompositeFetch, depth + 1, printWriter);
}
}
}
use of org.hibernate.loader.plan.spi.CompositeFetch in project hibernate-orm by hibernate.
the class AbstractRowReader method resolveEntityKey.
private void resolveEntityKey(ResultSet resultSet, ResultSetProcessingContextImpl context, FetchSource fetchSource) throws SQLException {
// Resolve any bidirectional entity references first.
for (BidirectionalEntityReference bidirectionalEntityReference : fetchSource.getBidirectionalEntityReferences()) {
final EntityReferenceInitializer targetEntityReferenceInitializer = entityInitializerByEntityReference.get(bidirectionalEntityReference.getTargetEntityReference());
resolveEntityKey(resultSet, context, targetEntityReferenceInitializer);
targetEntityReferenceInitializer.hydrateEntityState(resultSet, context);
}
for (Fetch fetch : fetchSource.getFetches()) {
if (EntityFetch.class.isInstance(fetch)) {
final EntityFetch entityFetch = (EntityFetch) fetch;
final EntityReferenceInitializer entityReferenceInitializer = entityInitializerByEntityReference.get(entityFetch);
if (entityReferenceInitializer != null) {
resolveEntityKey(resultSet, context, entityReferenceInitializer);
entityReferenceInitializer.hydrateEntityState(resultSet, context);
}
} else if (CompositeFetch.class.isInstance(fetch)) {
resolveEntityKey(resultSet, context, (CompositeFetch) fetch);
}
}
}
use of org.hibernate.loader.plan.spi.CompositeFetch in project hibernate-orm by hibernate.
the class ReturnGraphTreePrinter method writeFetch.
private void writeFetch(Fetch fetch, int depth, PrintWriter printWriter) {
printWriter.print(TreePrinterHelper.INSTANCE.generateNodePrefix(depth));
if (EntityFetch.class.isInstance(fetch)) {
final EntityFetch entityFetch = (EntityFetch) fetch;
printWriter.println(extractDetails(entityFetch));
writeEntityReferenceFetches(entityFetch, depth + 1, printWriter);
} else if (CompositeFetch.class.isInstance(fetch)) {
final CompositeFetch compositeFetch = (CompositeFetch) fetch;
printWriter.println(extractDetails(compositeFetch));
writeCompositeFetchFetches(compositeFetch, depth + 1, printWriter);
} else if (CollectionAttributeFetch.class.isInstance(fetch)) {
final CollectionAttributeFetch collectionFetch = (CollectionAttributeFetch) fetch;
printWriter.println(extractDetails(collectionFetch));
writeCollectionReferenceFetches(collectionFetch, depth + 1, printWriter);
}
}
use of org.hibernate.loader.plan.spi.CompositeFetch in project hibernate-orm by hibernate.
the class AbstractLoadPlanBuildingAssociationVisitationStrategy method handleCompositeAttribute.
protected boolean handleCompositeAttribute(AttributeDefinition attributeDefinition) {
final CompositeFetch compositeFetch = currentSource().buildCompositeAttributeFetch(attributeDefinition);
pushToStack((ExpandingFetchSource) compositeFetch);
return true;
}
Aggregations