Package org.hibernate.persister.walking.spi

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


  }

  @Override
  public AnyMappingDefinition toAnyDefinition() {
    if ( !isAnyType() ) {
      throw new WalkingException( "Cannot build AnyMappingDefinition from non-any-typed attribute" );
    }
    // todo : not sure how lazy is propogated into the component for a subattribute of type any
    return new StandardAnyTypeDefinition( (AnyType) getType(), false );
  }
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

    }
    else if ( indexType.isEntityType() || indexType.isComponentType() ) {
      // todo : validate the stack?
      final ExpandingFetchSource fetchSource = popFromStack();
      if ( !CollectionFetchableIndex.class.isInstance( fetchSource ) ) {
        throw new WalkingException(
            "CollectionReference did not return an expected index graph : " +
                indexDefinition.getCollectionDefinition().getCollectionPersister().getRole()
        );
      }
    }
View Full Code Here

      // pop it from the stack
      final ExpandingFetchSource popped = popFromStack();

      // validation
      if ( ! CollectionFetchableElement.class.isInstance( popped ) ) {
        throw new WalkingException( "Mismatched FetchSource from stack on pop" );
      }
    }

    log.tracef(
        "%s Finished collection element graph : %s",
View Full Code Here

    final FetchSource currentSource = currentSource();
    if ( !CompositeFetch.class.isInstance( currentSource ) &&
        !CollectionFetchableElement.class.isInstance( currentSource ) &&
        !CollectionFetchableIndex.class.isInstance( currentSource ) &&
        !ExpandingEntityIdentifierDescription.class.isInstance( currentSource ) ) {
      throw new WalkingException( "Mismatched FetchSource from stack on pop" );
    }
  }
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.