Package org.hibernate.loader.plan.spi

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


  public EntityReferenceProcessingState getOwnerProcessingState(Fetch fetch) {
    return getProcessingState( resolveFetchOwnerEntityReference( fetch ) );
  }

  private EntityReference resolveFetchOwnerEntityReference(Fetch fetch) {
    final FetchOwner fetchOwner = fetch.getOwner();

    if ( EntityReference.class.isInstance( fetchOwner ) ) {
      return (EntityReference) fetchOwner;
    }
    else if ( CompositeFetch.class.isInstance( fetchOwner ) ) {
View Full Code Here


      throw new NotYetImplementedException( "Cannot determine LHS alias for FetchOwner." );
    }
  }

  private static 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( 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

  }

  @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

  @Override
  public void foundCircularAssociation(AssociationAttributeDefinition attributeDefinition) {
    // todo : use this information to create the BiDirectionalEntityFetch instances
    final AssociationKey associationKey = attributeDefinition.getAssociationKey();
    final FetchOwner fetchOwner = fetchedAssociationKeyOwnerMap.get( associationKey );
    if ( fetchOwner == null ) {
      throw new IllegalStateException(
          String.format(
              "Expecting AssociationKey->FetchOwner mapping for %s",
              associationKey.toString()
View Full Code Here

    // for ANY mappings we need to build a Fetch:
    //    1) fetch type is SELECT, timing might be IMMEDIATE or DELAYED depending on whether it was defined as lazy
    //    2) (because the fetch cannot be a JOIN...) do not push it to the stack
    final FetchStrategy fetchStrategy = determineFetchPlan( attributeDefinition );

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

    fetchOwner.buildAnyFetch(
        attributeDefinition,
        anyDefinition,
        fetchStrategy,
        this
    );
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.