Package org.hibernate.persister.walking.spi

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


    }

    private <T> void popFromStack(Deque<T> stack, T expectedValue) {
      T poppedValue = stack.pop();
      if ( poppedValue != expectedValue ) {
        throw new WalkingException(
            String.format(
                "Unexpected value from stack. Expected=[%s]; instead it was [%s].",
                expectedValue,
                poppedValue
            )
View Full Code Here


  }

  @Override
  public void start() {
    if ( ! fetchOwnerStack.isEmpty() ) {
      throw new WalkingException(
          "Fetch owner stack was not empty on start; " +
              "be sure to not use LoadPlanBuilderStrategy instances concurrently"
      );
    }
    if ( ! collectionReferenceStack.isEmpty() ) {
      throw new WalkingException(
          "Collection reference 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 FetchOwner poppedFetchOwner = popFromStack();

    if ( ! EntityReference.class.isInstance( poppedFetchOwner ) ) {
      throw new WalkingException( "Mismatched FetchOwner from stack on pop" );
    }

    final EntityReference entityReference = (EntityReference) poppedFetchOwner;
    // 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 FetchOwner from stack on pop" );
    }

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

    final EntityReference entityReference = (EntityReference) currentFetchOwner();

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

    // 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() ) ) {
        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 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

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

    @Override
    public CollectionFetch buildCollectionFetch(
        AssociationAttributeDefinition attributeDefinition,
        FetchStrategy fetchStrategy,
        LoadPlanBuildingContext loadPlanBuildingContext) {
      throw new WalkingException( "Entity identifier cannot contain persistent collections" );
    }
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.