Package org.hibernate.loader.plan.spi

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


        this
    );
  }

  protected boolean handleCompositeAttribute(CompositionDefinition attributeDefinition) {
    final FetchOwner fetchOwner = currentFetchOwner();
    final CompositeFetch fetch = fetchOwner.buildCompositeFetch( attributeDefinition, this );
    pushToStack( fetch );
    return true;
  }
View Full Code Here


    }
//    if ( fetchStrategy.getTiming() != FetchTiming.IMMEDIATE ) {
//      return false;
//    }

    final FetchOwner fetchOwner = currentFetchOwner();
    fetchOwner.validateFetchPlan( fetchStrategy, attributeDefinition );

    final Fetch associationFetch;
    final AssociationAttributeDefinition.AssociationNature nature = attributeDefinition.getAssociationNature();
    if ( nature == AssociationAttributeDefinition.AssociationNature.ANY ) {
      return false;
//      throw new NotYetImplementedException( "AnyType support still in progress" );
    }
    else if ( nature == AssociationAttributeDefinition.AssociationNature.ENTITY ) {
      associationFetch = fetchOwner.buildEntityFetch(
          attributeDefinition,
          fetchStrategy,
          this
      );
    }
    else {
      associationFetch = fetchOwner.buildCollectionFetch( attributeDefinition, fetchStrategy, this );
      pushToCollectionStack( (CollectionReference) associationFetch );
    }

    if ( FetchOwner.class.isInstance( associationFetch) ) {
      pushToStack( (FetchOwner) associationFetch );
View Full Code Here

  private MDCStack mdcStack() {
    return (MDCStack) MDC.get( MDC_KEY );
  }

  private FetchOwner popFromStack() {
    final FetchOwner last = fetchOwnerStack.removeFirst();
    log.trace( "Popped fetch owner from stack : " + last );
    mdcStack().pop();
    if ( FetchStackAware.class.isInstance( last ) ) {
      ( (FetchStackAware) last ).poppedFromStack();
    }
View Full Code Here

    // Otherwise, read it from the ResultSet
    final String[] columnNames;
    if ( EntityFetch.class.isInstance( entityReference )
        && !FetchStrategyHelper.isJoinFetched( ((EntityFetch) entityReference).getFetchStrategy() ) ) {
      final EntityFetch fetch = (EntityFetch) entityReference;
      final FetchOwner fetchOwner = fetch.getOwner();
      if ( EntityReference.class.isInstance( fetchOwner ) ) {
        throw new NotYetImplementedException();
//          final EntityReference ownerEntityReference = (EntityReference) fetchOwner;
//          final EntityAliases ownerEntityAliases = context.getAliasResolutionContext()
//              .resolveEntityColumnAliases( ownerEntityReference );
View Full Code Here

      // how to best (a) find the bi-directionality and (b) represent that?

      if ( EntityFetch.class.isInstance( entityReference ) ) {
        // we just confirmed that EntityReference(Address) is an instance of EntityFetch(Address),
        final EntityFetch entityFetch = (EntityFetch) entityReference;
        final FetchOwner entityFetchOwner = entityFetch.getOwner();
        // so at this point we need to see if entityFetchOwner and attributeDefinition refer to the
        // "same thing".  "same thing" == "same type" && "same column(s)"?
        //
        // i make assumptions here that that the attribute type is the EntityType, is that always valid?
        final EntityType attributeDefinitionTypeAsEntityType = (EntityType) attributeDefinition.getType();

        final boolean sameType = attributeDefinitionTypeAsEntityType.getAssociatedEntityName().equals(
            entityFetchOwner.retrieveFetchSourcePersister().getEntityName()
        );

        if ( sameType ) {
          // check same columns as well?
View Full Code Here

    }
    return aliases;
  }

  private EntityReference locateCompositeFetchEntityReferenceSource(CompositeFetch composite) {
    final FetchOwner owner = composite.getOwner();
    if ( EntityReference.class.isInstance( owner ) ) {
      return (EntityReference) owner;
    }
    if ( CompositeFetch.class.isInstance( owner ) ) {
      return locateCompositeFetchEntityReferenceSource( (CompositeFetch) owner );
View Full Code Here

  protected abstract void addRootReturn(Return rootReturn);

  @Override
  public void finishingEntity(EntityDefinition entityDefinition) {
    // pop the current fetch owner, and make sure what we just popped represents this entity
    final FetchOwner poppedFetchOwner = popFromStack();

    if ( ! EntityReference.class.isInstance( poppedFetchOwner ) ) {
      throw new WalkingException( "Mismatched FetchOwner from stack on pop" );
    }
View Full Code Here

              entityIdentifierDefinition.getEntityDefinition().getEntityPersister().getEntityName()
          )
      );
    }

    final FetchOwner identifierAttributeCollector;
    if ( entityIdentifierDefinition.isEncapsulated() ) {
      identifierAttributeCollector = new EncapsulatedIdentifierAttributeCollector( entityReference );
    }
    else {
      identifierAttributeCollector = new NonEncapsulatedIdentifierAttributeCollector( entityReference );
View Full Code Here

  @Override
  public void finishingEntityIdentifier(EntityIdentifierDefinition entityIdentifierDefinition) {
    // perform some stack validation on exit, first on the current stack element we want to pop
    {
      final FetchOwner poppedFetchOwner = popFromStack();

      if ( ! AbstractIdentifierAttributeCollector.class.isInstance( poppedFetchOwner ) ) {
        throw new WalkingException( "Unexpected state in FetchOwner stack" );
      }

      final EntityReference entityReference = (EntityReference) poppedFetchOwner;
      if ( ! entityReference.getEntityPersister().equals( entityIdentifierDefinition.getEntityDefinition().getEntityPersister() ) ) {
        throw new WalkingException(
            String.format(
                "Encountered unexpected fetch owner [%s] in stack while processing entity identifier for [%s]",
                entityReference.getEntityPersister().getEntityName(),
                entityIdentifierDefinition.getEntityDefinition().getEntityPersister().getEntityName()
            )
        );
      }
    }

    // and then on the element before it
    {
      final FetchOwner currentFetchOwner = currentFetchOwner();
      if ( ! EntityReference.class.isInstance( currentFetchOwner ) ) {
        throw new WalkingException( "Unexpected state in FetchOwner stack" );
      }
      final EntityReference entityReference = (EntityReference) currentFetchOwner;
      if ( ! entityReference.getEntityPersister().equals( entityIdentifierDefinition.getEntityDefinition().getEntityPersister() ) ) {
View Full Code Here

  @Override
  public void startingCollectionIndex(CollectionIndexDefinition collectionIndexDefinition) {
    final Type indexType = collectionIndexDefinition.getType();
    if ( indexType.isAssociationType() || indexType.isComponentType() ) {
      final CollectionReference collectionReference = collectionReferenceStack.peekFirst();
      final FetchOwner indexGraph = collectionReference.getIndexGraph();
      if ( indexGraph == null ) {
        throw new WalkingException( "Collection reference did not return index handler" );
      }
      pushToStack( indexGraph );
    }
View Full Code Here

TOP

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

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.