Package org.hibernate.loader.plan2.exec.process.internal

Examples of org.hibernate.loader.plan2.exec.process.internal.EntityReferenceInitializerImpl


    printWriter.println(
        TreePrinterHelper.INSTANCE.generateNodePrefix( depth+3 )
            + "SQL table alias mapping - " + resolveSqlTableAliasFromQuerySpaceUid( querySpace.getUid() )
    );

    final EntityReferenceAliases entityAliases = resolveEntityReferenceAliases( querySpace.getUid() );
    final CollectionReferenceAliases collectionReferenceAliases = resolveCollectionReferenceAliases( querySpace.getUid() );

    if ( entityAliases != null ) {
      printWriter.println(
          TreePrinterHelper.INSTANCE.generateNodePrefix( depth+3 )
              + "alias suffix - " + entityAliases.getColumnAliases().getSuffix()
      );
      printWriter.println(
          TreePrinterHelper.INSTANCE.generateNodePrefix( depth+3 )
              + "suffixed key columns - "
              + StringHelper.join( ", ", entityAliases.getColumnAliases().getSuffixedKeyAliases() )
      );
    }

    if ( collectionReferenceAliases != null ) {
      printWriter.println(
View Full Code Here


    final String[] aliasedLhsColumnNames = join.resolveAliasedLeftHandSideJoinConditionColumns( leftHandSideTableAlias );

    final EntityQuerySpace rightHandSide = (EntityQuerySpace) join.getRightHandSide();

    // see if there is already aliases registered for this entity query space (collection joins)
    EntityReferenceAliases aliases = aliasResolutionContext.resolveEntityReferenceAliases( rightHandSide.getUid() );
    if ( aliases == null ) {
        aliases = aliasResolutionContext.generateEntityReferenceAliases(
          rightHandSide.getUid(),
          rightHandSide.getEntityPersister()
      );
    }

    final String[] rhsColumnNames = join.resolveNonAliasedRightHandSideJoinConditionColumns();
    final String rhsTableAlias = aliases.getTableAlias();
    final AssociationType associationType = join instanceof JoinDefinedByMetadata ? ((JoinDefinedByMetadata)join).getJoinedAssociationPropertyType() : null;
    final String additionalJoinConditions = resolveAdditionalJoinCondition(
        rhsTableAlias,
        join.getAnyAdditionalJoinConditions( rhsTableAlias ),
        (Joinable) rightHandSide.getEntityPersister(),
        associationType
    );

    final Joinable joinable = (Joinable) rightHandSide.getEntityPersister();
    addJoins(
        joinFragment,
        joinable,
        join.isRightHandSideRequired() ? JoinType.INNER_JOIN : JoinType.LEFT_OUTER_JOIN,
        aliases.getTableAlias(),
        rhsColumnNames,
        aliasedLhsColumnNames,
        additionalJoinConditions
    );
  }
View Full Code Here

    fetchStats.processingFetch( fetch );

    // First write out the SQL SELECT fragments
    final Joinable joinable = (Joinable) fetch.getEntityPersister();
    final EntityReferenceAliases aliases = aliasResolutionContext.resolveEntityReferenceAliases(
        fetch.getQuerySpaceUid()
    );
    // the null arguments here relate to many-to-many fetches
    selectStatementBuilder.appendSelectClauseFragment(
        joinable.selectFragment(
            null,
            null,
            aliases.getTableAlias(),
            aliases.getColumnAliases().getSuffix(),
            null,
            true
        )
    );
View Full Code Here

      if ( StringHelper.isNotEmpty( ordering ) ) {
        selectStatementBuilder.appendOrderByFragment( ordering );
      }

      // add an EntityReferenceInitializer for the collection elements (keys also?)
      final EntityReferenceAliases entityReferenceAliases = new EntityReferenceAliases() {
        @Override
        public String getTableAlias() {
          return aliases.getCollectionTableAlias();
        }

        @Override
        public EntityAliases getColumnAliases() {
          return aliases.getEntityElementColumnAliases();
        }
      };
      aliasResolutionContext.registerQuerySpaceAliases( fetch.getQuerySpaceUid(), entityReferenceAliases );
      readerCollector.add(
          new EntityReferenceInitializerImpl(
              (EntityReference) fetch.getElementGraph(),
              entityReferenceAliases
          )
      );
    }
    else {
      final String rhsTableAlias = aliases.getElementTableAlias();

      // select the "collection columns"
      selectStatementBuilder.appendSelectClauseFragment(
          queryableCollection.selectFragment(
              rhsTableAlias,
              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 EntityReferenceAliases() {
          @Override
          public String getTableAlias() {
            return aliases.getElementTableAlias();
          }
View Full Code Here

            + "SQL table alias mapping - " + aliasResolutionContext.resolveSqlTableAliasFromQuerySpaceUid(
            querySpace.getUid()
        )
    );

    final EntityReferenceAliases entityAliases = aliasResolutionContext.resolveEntityReferenceAliases( querySpace.getUid() );
    final CollectionReferenceAliases collectionReferenceAliases = aliasResolutionContext.resolveCollectionReferenceAliases( querySpace.getUid() );

    if ( entityAliases != null ) {
      printWriter.println(
          TreePrinterHelper.INSTANCE.generateNodePrefix( depth + detailDepthOffset )
              + "alias suffix - " + entityAliases.getColumnAliases().getSuffix()
      );
      printWriter.println(
          TreePrinterHelper.INSTANCE.generateNodePrefix( depth + detailDepthOffset )
              + "suffixed key columns - {"
              + StringHelper.join( ", ", entityAliases.getColumnAliases().getSuffixedKeyAliases() )
              + "}"
      );
    }

    if ( collectionReferenceAliases != null ) {
View Full Code Here

              attributeDefinition.getName()
          )
      );
    }

    final BidirectionalEntityReference bidirectionalEntityReference =
        new BidirectionalEntityReferenceImpl( this, attributeDefinition, targetEntityReference );
    addBidirectionalEntityReference( bidirectionalEntityReference );
    return bidirectionalEntityReference;
  }
View Full Code Here

          readerCollector,
          fetchStats
      );
    }
    else if ( CollectionFetch.class.isInstance( fetch ) ) {
      final CollectionFetch collectionFetch = (CollectionFetch) fetch;
      processCollectionFetch(
          selectStatementBuilder,
          fetchSource,
          collectionFetch,
          readerCollector,
View Full Code Here

      final CompositeFetch compositeFetch = (CompositeFetch) fetch;
      printWriter.println( extractDetails( compositeFetch ) );
      writeCompositeFetchFetches( compositeFetch, depth+1, printWriter );
    }
    else if ( CollectionFetch.class.isInstance( fetch ) ) {
      final CollectionFetch collectionFetch = (CollectionFetch) fetch;
      printWriter.println( extractDetails( collectionFetch ) );
      writeCollectionReferenceFetches( collectionFetch, depth+1, printWriter );
    }
  }
View Full Code Here

    final Join join = querySpace.addCollectionJoin(
        attributeDefinition,
        fetchedPersister,
        loadPlanBuildingContext.getQuerySpaces().generateImplicitUid()
    );
    final CollectionFetch fetch = new CollectionFetchImpl(
        this,
        attributeDefinition,
        fetchStrategy,
        join,
        loadPlanBuildingContext
View Full Code Here

      );
      pushToStack( (ExpandingFetchSource) fetch );
    }
    else {
      // Collection
      CollectionFetch fetch = currentSource.buildCollectionFetch( attributeDefinition, fetchStrategy, this );
      pushToCollectionStack( fetch );
    }
    return true;
  }
View Full Code Here

TOP

Related Classes of org.hibernate.loader.plan2.exec.process.internal.EntityReferenceInitializerImpl

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.