Package org.hibernate.persister.walking.spi

Examples of org.hibernate.persister.walking.spi.WalkingException


  @Override
  public void finishingCollection(CollectionDefinition collectionDefinition) {
    // pop the current fetch owner, and make sure what we just popped represents this collection
    final CollectionReference collectionReference = popFromCollectionStack();
    if ( ! collectionReference.getCollectionPersister().equals( collectionDefinition.getCollectionPersister() ) ) {
      throw new WalkingException( "Mismatched FetchOwner from stack on pop" );
    }

    log.tracef(
        "%s Finished collection : %s",
        StringHelper.repeat( "<<", fetchOwnerStack.size() ),
View Full Code Here


  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" );
    }

    // NOTE : not much else we can really check here atm since on the walking spi side we do not have path

    log.tracef(
View Full Code Here

      }
      selectFragmentRangeStart += typeColSpan;
    }

    if ( subIndex < 0 ) {
      throw new WalkingException(
          String.format(
              "Owner property [%s] not found in composite properties [%s]",
              fetch.getOwnerPropertyName(),
              Arrays.asList( compositeType.getPropertyNames() )
          )
View Full Code Here

                  return (EntityPersister) aType.getAssociatedJoinable( ownerEntityPersister.getFactory() );
                }

                @Override
                public CollectionDefinition toCollectionDefinition() {
                  throw new WalkingException( "A collection cannot be mapped to a composite ID sub-attribute." );
                }

                @Override
                public FetchStrategy determineFetchPlan(LoadQueryInfluencers loadQueryInfluencers, PropertyPath propertyPath) {
                  return new FetchStrategy( FetchTiming.IMMEDIATE, FetchStyle.JOIN );
View Full Code Here

  // top-level AssociationVisitationStrategy hooks ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

  @Override
  public void start() {
    if ( ! fetchSourceStack.isEmpty() ) {
      throw new WalkingException(
          "Fetch owner stack was not empty on start; " +
              "be sure to not use LoadPlanBuilderStrategy instances concurrently"
      );
    }
    propertyPathStack.push( new PropertyPath() );
View Full Code Here

  }

  private void checkPoppedEntity(ExpandingFetchSource fetchSource, EntityDefinition entityDefinition) {
    // make sure what we just fetchSource represents entityDefinition
    if ( ! EntityReference.class.isInstance( fetchSource ) ) {
      throw new WalkingException(
          String.format(
              "Mismatched FetchSource from stack on pop.  Expecting EntityReference(%s), but found %s",
              entityDefinition.getEntityPersister().getEntityName(),
              fetchSource
          )
      );
    }

    final EntityReference entityReference = (EntityReference) fetchSource;
    // NOTE : this is not the most exhaustive of checks because of hierarchical associations (employee/manager)
    if ( ! entityReference.getEntityPersister().equals( entityDefinition.getEntityPersister() ) ) {
      throw new WalkingException( "Mismatched FetchSource from stack on pop" );
    }
  }
View Full Code Here

    final EntityReference entityReference = (EntityReference) currentSource();

    // perform some stack validation
    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()
          )
View Full Code Here

    // only pop from stack if the current source is ExpandingEntityIdentifierDescription..
    final ExpandingFetchSource currentSource = currentSource();
    if ( ! ExpandingEntityIdentifierDescription.class.isInstance( currentSource ) ) {
      // in this case, the current source should be the entity that owns entityIdentifierDefinition
      if ( ! EntityReference.class.isInstance( currentSource ) ) {
        throw new WalkingException( "Unexpected state in FetchSource stack" );
      }
      final EntityReference entityReference = (EntityReference) currentSource;
      if ( entityReference.getEntityPersister().getEntityKeyDefinition() != entityIdentifierDefinition ) {
        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()
            )
        );
      }
      return;
    }

    // the current source is ExpandingEntityIdentifierDescription...
    final ExpandingEntityIdentifierDescription identifierDescription =
        (ExpandingEntityIdentifierDescription) popFromStack();

    // and then on the node before it (which should be the entity that owns the identifier being described)
    final ExpandingFetchSource entitySource = currentSource();
    if ( ! EntityReference.class.isInstance( entitySource ) ) {
      throw new WalkingException( "Unexpected state in FetchSource stack" );
    }
    final EntityReference entityReference = (EntityReference) entitySource;
    if ( entityReference.getIdentifierDescription() != identifierDescription ) {
      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()
          )
View Full Code Here

  }

  private void checkedPoppedCollection(CollectionReference poppedCollectionReference, CollectionDefinition collectionDefinition) {
    // make sure what we just poppedCollectionReference represents collectionDefinition.
    if ( ! poppedCollectionReference.getCollectionPersister().equals( collectionDefinition.getCollectionPersister() ) ) {
      throw new WalkingException( "Mismatched CollectionReference from stack on pop" );
    }
  }
View Full Code Here

    final CollectionReference collectionReference = currentCollection();
    final CollectionFetchableIndex indexGraph = collectionReference.getIndexGraph();

    if ( indexType.isEntityType() || indexType.isComponentType() ) {
      if ( indexGraph == null ) {
        throw new WalkingException(
            "CollectionReference did not return an expected index graph : " +
                indexDefinition.getCollectionDefinition().getCollectionPersister().getRole()
        );
      }
      if ( !indexType.isAnyType() ) {
        pushToStack( (ExpandingFetchSource) indexGraph );
      }
    }
    else {
      if ( indexGraph != null ) {
        throw new WalkingException(
            "CollectionReference returned an unexpected index graph : " +
                indexDefinition.getCollectionDefinition().getCollectionPersister().getRole()
        );
      }
    }
View Full Code Here

TOP

Related Classes of org.hibernate.persister.walking.spi.WalkingException

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.