Package org.hibernate.persister.walking.spi

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


    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

  public void finish() {
    super.finish();
    graphStack.removeLast();
    //applying a little internal stack checking
    if ( !graphStack.isEmpty() || !attributeStack.isEmpty() || !attributeMapStack.isEmpty() ) {
      throw new WalkingException( "Internal stack error" );
    }
  }
View Full Code Here

  private Joinable joinable;

  protected Joinable getJoinable() {
    if ( getAssociationNature() == AssociationNature.ANY ) {
      throw new WalkingException( "Cannot resolve AnyType to a Joinable" );
    }

    if ( joinable == null ) {
      joinable = getType().getAssociatedJoinable( sessionFactory() );
    }
View Full Code Here

  }

  @Override
  public EntityDefinition toEntityDefinition() {
    if ( getAssociationNature() == AssociationNature.ANY ) {
      throw new WalkingException( "Cannot treat any-type attribute as an entity type" );
    }
    if ( getAssociationNature() == AssociationNature.COLLECTION ) {
      throw new IllegalStateException( "Cannot treat collection-valued attribute as entity type" );
    }
    return (EntityPersister) getJoinable();
View Full Code Here

  }

  @Override
  public CollectionDefinition toCollectionDefinition() {
    if ( getAssociationNature() == AssociationNature.ANY ) {
      throw new WalkingException( "Cannot treat any-type attribute as a collection type" );
    }
    if ( getAssociationNature() == AssociationNature.ENTITY ) {
      throw new IllegalStateException( "Cannot treat entity-valued attribute as collection type" );
    }
    return (QueryableCollection) getJoinable();
View Full Code Here

      FetchStrategy fetchStrategy) {
    final EntityType fetchedType = (EntityType) attribute.getType();
    final EntityPersister fetchedPersister = attribute.toEntityDefinition().getEntityPersister();

    if ( fetchedPersister == null ) {
      throw new WalkingException(
          String.format(
              "Unable to locate EntityPersister [%s] for fetch [%s]",
              fetchedType.getAssociatedEntityName(),
              attribute.getName()
          )
View Full Code Here

    final CollectionType fetchedType = (CollectionType) attributeDefinition.getType();
    final CollectionPersister fetchedPersister = attributeDefinition.toCollectionDefinition().getCollectionPersister();

    if ( fetchedPersister == null ) {
      throw new WalkingException(
          String.format(
              "Unable to locate CollectionPersister [%s] for fetch [%s]",
              fetchedType.getRole(),
              attributeDefinition.getName()
          )
View Full Code Here

      EntityReference targetEntityReference) {
    final EntityType fetchedType = (EntityType) attributeDefinition.getType();
    final EntityPersister fetchedPersister = attributeDefinition.toEntityDefinition().getEntityPersister();

    if ( fetchedPersister == null ) {
      throw new WalkingException(
          String.format(
              "Unable to locate EntityPersister [%s] for bidirectional entity reference [%s]",
              fetchedType.getAssociatedEntityName(),
              attributeDefinition.getName()
          )
View Full Code Here

  @Override
  public CollectionAttributeFetch buildCollectionAttributeFetch(
      AssociationAttributeDefinition attributeDefinition,
      FetchStrategy fetchStrategy) {
    if ( !allowCollectionFetches ) {
      throw new WalkingException(
          String.format(
              "This composite path [%s] does not allow collection fetches (composite id or composite collection index/element",
              getPropertyPath().getFullPath()
          )
      );
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.