Search in sources :

Example 6 with QuerySpace

use of org.hibernate.loader.plan.spi.QuerySpace in project hibernate-orm by hibernate.

the class QuerySpacesImpl method registerQuerySpace.

/**
	 * Feeds a QuerySpace into this spaces group.
	 *
	 * @param querySpace The space
	 */
private void registerQuerySpace(QuerySpace querySpace) {
    log.debugf("Adding QuerySpace : uid = %s -> %s]", querySpace.getUid(), querySpace);
    final QuerySpace previous = querySpaceByUid.put(querySpace.getUid(), querySpace);
    if (previous != null) {
        throw new IllegalStateException("Encountered duplicate QuerySpace uid : " + querySpace.getUid());
    }
}
Also used : ExpandingCompositeQuerySpace(org.hibernate.loader.plan.build.spi.ExpandingCompositeQuerySpace) QuerySpace(org.hibernate.loader.plan.spi.QuerySpace) ExpandingEntityQuerySpace(org.hibernate.loader.plan.build.spi.ExpandingEntityQuerySpace) ExpandingCollectionQuerySpace(org.hibernate.loader.plan.build.spi.ExpandingCollectionQuerySpace)

Example 7 with QuerySpace

use of org.hibernate.loader.plan.spi.QuerySpace in project hibernate-orm by hibernate.

the class QuerySpaceTreePrinter method write.

/**
	 * Returns a String containing the {@link QuerySpaces} graph as a tree structure, starting
	 * at a particular depth.
	 *
	 * The value for depth indicates the number of indentations that will
	 * prefix all lines in the returned String. Root query spaces will be written with depth + 1
	 * and the depth will be further incremented as joined query spaces are traversed.
	 *
	 * An indentation is defined as the number of characters defined by {@link TreePrinterHelper#INDENTATION}.
	 *
	 * @param spaces The {@link QuerySpaces} object.
	 * @param depth The intial number of indentations
	 * @param aliasResolutionContext The context for resolving table and column aliases
	 *        for the {@link QuerySpace} references in <code>spaces</code>; if null,
	 *        table and column aliases are not included in returned value.
	 * @param printWriter The print writer for writing.
	 */
public void write(QuerySpaces spaces, int depth, AliasResolutionContext aliasResolutionContext, PrintWriter printWriter) {
    if (spaces == null) {
        printWriter.println("QuerySpaces is null!");
        return;
    }
    printWriter.println(TreePrinterHelper.INSTANCE.generateNodePrefix(depth) + "QuerySpaces");
    for (QuerySpace querySpace : spaces.getRootQuerySpaces()) {
        writeQuerySpace(querySpace, depth + 1, aliasResolutionContext, printWriter);
    }
    printWriter.flush();
}
Also used : QuerySpace(org.hibernate.loader.plan.spi.QuerySpace) CompositeQuerySpace(org.hibernate.loader.plan.spi.CompositeQuerySpace) CollectionQuerySpace(org.hibernate.loader.plan.spi.CollectionQuerySpace) EntityQuerySpace(org.hibernate.loader.plan.spi.EntityQuerySpace)

Aggregations

QuerySpace (org.hibernate.loader.plan.spi.QuerySpace)7 EntityGraph (javax.persistence.EntityGraph)4 EntityManager (javax.persistence.EntityManager)4 AliasResolutionContextImpl (org.hibernate.loader.plan.exec.internal.AliasResolutionContextImpl)4 Join (org.hibernate.loader.plan.spi.Join)4 LoadPlan (org.hibernate.loader.plan.spi.LoadPlan)4 Test (org.junit.Test)4 ByteArrayOutputStream (java.io.ByteArrayOutputStream)1 PrintStream (java.io.PrintStream)1 PrintWriter (java.io.PrintWriter)1 ExpandingCollectionQuerySpace (org.hibernate.loader.plan.build.spi.ExpandingCollectionQuerySpace)1 ExpandingCompositeQuerySpace (org.hibernate.loader.plan.build.spi.ExpandingCompositeQuerySpace)1 ExpandingEntityQuerySpace (org.hibernate.loader.plan.build.spi.ExpandingEntityQuerySpace)1 CollectionQuerySpace (org.hibernate.loader.plan.spi.CollectionQuerySpace)1 CompositeQuerySpace (org.hibernate.loader.plan.spi.CompositeQuerySpace)1 EntityQuerySpace (org.hibernate.loader.plan.spi.EntityQuerySpace)1