Package org.hibernate.persister.walking.spi

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


    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

    else if ( attributeType.isComponentType() ) {
      // CompositeFetch is always pushed, during #startingAttribute(),
      // so pop the current fetch owner, and make sure what we just popped represents this composition
      final ExpandingFetchSource popped = popFromStack();
      if ( !CompositeAttributeFetch.class.isInstance( popped ) ) {
        throw new WalkingException(
            String.format(
                "Mismatched FetchSource from stack on pop; expected: CompositeAttributeFetch; actual: [%s]",
                popped
            )
        );
      }
      final CompositeAttributeFetch poppedAsCompositeAttributeFetch = (CompositeAttributeFetch) popped;
      if ( !attributeDefinition.equals( poppedAsCompositeAttributeFetch.getFetchedAttributeDefinition() ) ) {
        throw new WalkingException(
            String.format(
                "Mismatched CompositeAttributeFetch from stack on pop; expected fetch for attribute: [%s]; actual: [%s]",
                attributeDefinition,
                poppedAsCompositeAttributeFetch.getFetchedAttributeDefinition()
            )
View Full Code Here

                }

                @Override
                public EntityDefinition toEntityDefinition() {
                  if ( getAssociationNature() != AssociationNature.ENTITY ) {
                    throw new WalkingException(
                        "Cannot build EntityDefinition from non-entity-typed attribute"
                    );
                  }
                  return (EntityPersister) aType.getAssociatedJoinable( ownerEntityPersister.getFactory() );
                }

                @Override
                public AnyMappingDefinition toAnyDefinition() {
                  if ( getAssociationNature() != AssociationNature.ANY ) {
                    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) aType, false );
                }

                @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

    JoinableAssociationAliasesImpl aliases = aliasesByJoinableAssociation.get( joinableAssociation );
    if ( aliases == null ) {
      final Fetch currentFetch = joinableAssociation.getCurrentFetch();
      final String lhsAlias;
      if ( AnyFetch.class.isInstance( currentFetch ) ) {
        throw new WalkingException( "Any type should never be joined!" );
      }
      else if ( EntityReference.class.isInstance( currentFetch.getOwner() ) ) {
        lhsAlias = resolveAliases( (EntityReference) currentFetch.getOwner() ).getTableAlias();
      }
      else if ( CompositeFetch.class.isInstance( currentFetch.getOwner() ) ) {
View Full Code Here

    }
    if ( CompositeFetch.class.isInstance( owner ) ) {
      return locateCompositeFetchEntityReferenceSource( (CompositeFetch) owner );
    }

    throw new WalkingException( "Cannot resolve entity source for a CompositeFetch" );
  }
View Full Code Here

      Fetch fetch,
      AliasResolutionContext aliasResolutionContext) {
    // IMPL NOTE : the fetch-owner is the LHS; the fetch is the RHS

    if ( AnyFetch.class.isInstance( fetchOwner ) ) {
      throw new WalkingException( "Any type should never be joined!" );
    }
    else if ( EntityReference.class.isInstance( fetchOwner ) ) {
      return aliasResolutionContext.resolveAliases( (EntityReference) fetchOwner ).getTableAlias();
    }
    else if ( CompositeFetch.class.isInstance( fetchOwner ) ) {
View Full Code Here

    }
    if ( CompositeFetch.class.isInstance( owner ) ) {
      return locateCompositeFetchEntityReferenceSource( (CompositeFetch) owner );
    }

    throw new WalkingException( "Cannot resolve entity source for a CompositeFetch" );
  }
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.