Package org.hibernate.persister.walking.spi

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


  // 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"
      );
    }
    MDC.put( MDC_KEY, new MDCStack() );
View Full Code Here


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

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

    log.tracef(
        "%s Finished entity : %s",
        StringHelper.repeat( "<<", fetchSourceStack.size() ),
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

    final ExpandingFetchSource popped = popFromStack();

    // perform some stack validation on exit, first on the current stack element we want to pop
    if ( ! ExpandingEntityIdentifierDescription.class.isInstance( popped ) ) {
      throw new WalkingException( "Unexpected state in FetchSource stack" );
    }

    final ExpandingEntityIdentifierDescription identifierDescription = (ExpandingEntityIdentifierDescription) popped;

    // 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

  @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 FetchSource from stack on pop" );
    }

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

  @Override
  public void startingCollectionIndex(CollectionIndexDefinition indexDefinition) {
    final Type indexType = indexDefinition.getType();
    if ( indexType.isAnyType() ) {
      throw new WalkingException( "CollectionIndexDefinition reported any-type mapping as map index" );
    }

    log.tracef(
        "%s Starting collection index graph : %s",
        StringHelper.repeat( ">>", fetchSourceStack.size() ),
        indexDefinition.getCollectionDefinition().getCollectionPersister().getRole()
    );

    final CollectionReference collectionReference = collectionReferenceStack.peekFirst();
    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()
        );
      }
      pushToStack( (ExpandingFetchSource) indexGraph );
    }
    else {
      if ( indexGraph != null ) {
        throw new WalkingException(
            "CollectionReference returned an unexpected index graph : " +
                indexDefinition.getCollectionDefinition().getCollectionPersister().getRole()
        );
      }
    }
View Full Code Here

      final ExpandingFetchSource popped = popFromStack();

      // validation

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

    // entity indexes would be popped during finishingEntity processing
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 ExpandingFetchSource popped = popFromStack();

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

    log.tracef(
        "%s Finishing composite : %s",
        StringHelper.repeat( "<<", fetchSourceStack.size() ),
View Full Code Here

    }

    @Override
    public void startingRootReturn(Return rootReturn) {
      if ( !EntityReturn.class.isInstance( rootReturn ) ) {
        throw new WalkingException(
            String.format(
                "Unexpected type of return; expected [%s]; instead it was [%s]",
                EntityReturn.class.getName(),
                rootReturn.getClass().getName()
            )
View Full Code Here

    }

    @Override
    public void finishingRootReturn(Return rootReturn) {
      if ( !EntityReturn.class.isInstance( rootReturn ) ) {
        throw new WalkingException(
            String.format(
                "Unexpected type of return; expected [%s]; instead it was [%s]",
                EntityReturn.class.getName(),
                rootReturn.getClass().getName()
            )
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.