Package org.hibernate.persister.walking.spi

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


      return propertyPath;
    }

    @Override
    public void injectIdentifierDescription(IdentifierDescription identifierDescription) {
      throw new WalkingException(
          "IdentifierDescription collector should not get injected with IdentifierDescription"
      );
    }
View Full Code Here


      final Type idType = entityPersister.getIdentifierType();
      if ( CompositeType.class.isInstance( idType ) ) {
        final CompositeType cidType = (CompositeType) idType;
        if ( entityPersister.hasIdentifierProperty() ) {
          // encapsulated composite id case; this *should have* been handled as part of building the fetch...
          throw new WalkingException(
              "Expecting different FetchOwnerDelegate type for encapsulated composite id case"
          );
        }
        else {
          // non-encapsulated composite id case...
          return new NonEncapsulatedIdentifierAttributeFetchMetadata(
              entityPersister,
              cidType,
              fetch.getOwnerPropertyName()
          );
        }
      }
    }
    else {
      return new NonIdentifierAttributeFetchMetadata(
          entityPersister,
          fetch.getOwnerPropertyName(),
          propertyIndex.intValue()
      );
    }

    throw new WalkingException(
        "Could not locate metadata about given fetch [" + fetch + "] in its owning persister"
    );
  }
View Full Code Here

        }
        selectFragmentRangeStart += subType.getColumnSpan( entityPersister.getFactory() );
      }

      if ( !foundIt ) {
        throw new WalkingException( "Could not find " );
      }

      selectFragmentRangeEnd = selectFragmentRangeStart + type.getColumnSpan( entityPersister.getFactory() );
    }
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

  public void finishingCompositeCollectionElement(CompositeCollectionElementDefinition compositeElementDefinition) {
    // pop the current fetch owner, and make sure what we just popped represents this composition
    final FetchOwner poppedFetchOwner = popFromStack();

    if ( ! CompositeElementGraph.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

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.