Package org.hibernate.loader.plan.spi

Examples of org.hibernate.loader.plan.spi.EntityReturn


    if ( ScalarReturn.class.isInstance( rootReturn ) ) {
      printWriter.println( extractDetails( (ScalarReturn) rootReturn ) );
    }
    else if ( EntityReturn.class.isInstance( rootReturn ) ) {
      final EntityReturn entityReturn = (EntityReturn) rootReturn;
      printWriter.println( extractDetails( entityReturn ) );
      writeEntityReferenceFetches( entityReturn, depth+1, printWriter );
    }
    else if ( CollectionReference.class.isInstance( rootReturn ) ) {
      final CollectionReference collectionReference = (CollectionReference) rootReturn;
View Full Code Here


    // TODO: how should shouldUseOptionalEntityInformation be used?
    // final int batchSize = buildingParameters.getBatchSize();
    // final boolean shouldUseOptionalEntityInformation = batchSize == 1;

    final EntityReturn rootReturn = RootHelper.INSTANCE.extractRootReturn( loadPlan, EntityReturn.class );
    final String[] keyColumnNamesToUse = keyColumnNames != null
        ? keyColumnNames
        : ( (Queryable) rootReturn.getEntityPersister() ).getIdentifierColumnNames();
    // Should be just one querySpace (of type EntityQuerySpace) in querySpaces.  Should we validate that?
    // Should we make it a util method on Helper like we do for extractRootReturn ?
    final AliasResolutionContextImpl aliasResolutionContext = new AliasResolutionContextImpl( factory );
    return new EntityLoadQueryDetails(
        loadPlan,
View Full Code Here

    if ( root == null ) {
      log.debug( "Skipping load plan advising: no entity graph was specified" );
    }
    else {
      // for now, lets assume that the graph and the load-plan returns have to match up
      EntityReturn entityReturn = findRootEntityReturn( loadPlan );
      if ( entityReturn == null ) {
        log.debug( "Skipping load plan advising: not able to find appropriate root entity return in load plan" );
      }
      else {
        final String entityName = entityReturn.getEntityPersister().getEntityName();
        if ( ! root.appliesTo( entityName ) ) {
          log.debugf(
              "Skipping load plan advising: entity types did not match : [%s] and [%s]",
              root.getEntityType().getName(),
              entityName
View Full Code Here

    // return the original load-plan
    return loadPlan;
  }

  private LoadPlan applyAdvice(final EntityReturn entityReturn) {
    final EntityReturn copy = entityReturn.makeCopy( new CopyContextImpl( entityReturn ) );
    return new LoadPlanImpl( copy );
  }
View Full Code Here

    final EntityReturn copy = entityReturn.makeCopy( new CopyContextImpl( entityReturn ) );
    return new LoadPlanImpl( copy );
  }

  private EntityReturn findRootEntityReturn(LoadPlan loadPlan) {
    EntityReturn rootEntityReturn = null;
    for ( Return rtn : loadPlan.getReturns() ) {
      if ( ! EntityReturn.class.isInstance( rtn ) ) {
        continue;
      }
View Full Code Here

    if ( ScalarReturn.class.isInstance( rootReturn ) ) {
      printWriter.println( extractDetails( (ScalarReturn) rootReturn ) );
    }
    else if ( EntityReturn.class.isInstance( rootReturn ) ) {
      final EntityReturn entityReturn = (EntityReturn) rootReturn;
      printWriter.println( extractDetails( entityReturn ) );
      writeEntityReferenceFetches( entityReturn, depth+1, printWriter );
    }
    else if ( CollectionReference.class.isInstance( rootReturn ) ) {
      final CollectionReference collectionReference = (CollectionReference) rootReturn;
View Full Code Here

      QueryBuildingParameters buildingParameters,
      SessionFactoryImplementor factory) {
    final int batchSize = buildingParameters.getBatchSize();
    final boolean shouldUseOptionalEntityInformation = batchSize == 1;

    final EntityReturn rootReturn = Helper.INSTANCE.extractRootReturn( loadPlan, EntityReturn.class );
    final String[] keyColumnNamesToUse = keyColumnNames != null
        ? keyColumnNames
        : ( (Queryable) rootReturn.getEntityPersister() ).getIdentifierColumnNames();
    // Should be just one querySpace (of type EntityQuerySpace) in querySpaces.  Should we validate that?
    // Should we make it a util method on Helper like we do for extractRootReturn ?
    final AliasResolutionContextImpl aliasResolutionContext = new AliasResolutionContextImpl( factory );
    return new EntityLoadQueryDetails(
        loadPlan,
View Full Code Here

    if ( fetchOwnerStack.isEmpty() ) {
      // this is a root...
      if ( ! supportsRootEntityReturns() ) {
        throw new HibernateException( "This strategy does not support root entity returns" );
      }
      final EntityReturn entityReturn = buildRootEntityReturn( entityDefinition );
      addRootReturn( entityReturn );
      pushToStack( entityReturn );
    }
    // otherwise this call should represent a fetch which should have been handled in #startingAttribute
  }
View Full Code Here

      QueryBuildingParameters buildingParameters,
      SessionFactoryImplementor factory) {
    this.loadPlan = loadPlan;

    final SelectStatementBuilder select = new SelectStatementBuilder( factory.getDialect() );
    final EntityReturn rootReturn = Helper.INSTANCE.extractRootReturn( loadPlan, EntityReturn.class );
    final AliasResolutionContext aliasResolutionContext = new AliasResolutionContextImpl( factory );
    final ReaderCollectorImpl readerCollector = new ReaderCollectorImpl();

    final String[] keyColumnNamesToUse = keyColumnNames != null
        ? keyColumnNames
        : ( (Queryable) rootReturn.getEntityPersister() ).getIdentifierColumnNames();

    // apply root entity return specifics
    applyRootReturnSpecifics(
        select,
        keyColumnNamesToUse,
View Full Code Here

  public String generateSql(
      LoadPlan loadPlan,
      SessionFactoryImplementor factory,
      QueryBuildingParameters buildingParameters,
      AliasResolutionContext aliasResolutionContext) {
    final EntityReturn rootReturn = Helper.INSTANCE.extractRootReturn( loadPlan, EntityReturn.class );

    return generateSql(
        ( (Queryable) rootReturn.getEntityPersister() ).getKeyColumnNames(),
        rootReturn,
        factory,
        buildingParameters,
        aliasResolutionContext
    );
View Full Code Here

TOP

Related Classes of org.hibernate.loader.plan.spi.EntityReturn

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.