Package org.hibernate.loader.plan.spi

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


  }

  @Override
  public void finishingCompositeCollectionElement(CompositeCollectionElementDefinition compositeElementDefinition) {
    // pop the current fetch owner, and make sure what we just popped represents this composition
    final FetchOwner poppedFetchOwner = popFromStack();

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


  }

  @Override
  public void finishingComposite(CompositionDefinition compositionDefinition) {
    // pop the current fetch owner, and make sure what we just popped represents this composition
    final FetchOwner poppedFetchOwner = popFromStack();

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

        attributeDefinition
    );
  }

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

    final FetchStrategy fetchStrategy = determineFetchPlan( attributeDefinition );
    if ( fetchStrategy.getTiming() != FetchTiming.IMMEDIATE ) {
      return false;
    }

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

    final Fetch associationFetch;
    if ( attributeDefinition.isCollection() ) {
      associationFetch = fetchOwner.buildCollectionFetch( attributeDefinition, fetchStrategy, this );
      pushToCollectionStack( (CollectionReference) associationFetch );
    }
    else {
      associationFetch = fetchOwner.buildEntityFetch(
          attributeDefinition,
          fetchStrategy,
          this
      );
    }
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

  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( sessionFactory, entityReference );
    }
    else {
      identifierAttributeCollector = new NonEncapsulatedIdentifierAttributeCollector( sessionFactory, 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

  @Override
  public void startingCollectionElements(CollectionElementDefinition elementDefinition) {
    if ( elementDefinition.getType().isAssociationType() || elementDefinition.getType().isComponentType() ) {
      final CollectionReference collectionReference = collectionReferenceStack.peekFirst();
      final FetchOwner elementGraph = collectionReference.getElementGraph();
      if ( elementGraph == null ) {
        throw new WalkingException( "Collection reference did not return element handler" );
      }
      pushToStack( elementGraph );
    }
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.