Package org.hibernate.persister.walking.spi

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


            int columnPosition = currentColumnPosition;
            currentColumnPosition += type.getColumnSpan( sessionFactory() );

            if ( type.isAssociationType() ) {
              // we build the association-key here because of the "goofiness" with 'currentColumnPosition'
              final AssociationKey associationKey;
              final AssociationType aType = (AssociationType) type;
              final Joinable joinable = aType.getAssociatedJoinable( sessionFactory() );

              if ( aType.isAnyType() ) {
                associationKey = new AssociationKey(
                    JoinHelper.getLHSTableName(
                        aType,
                        attributeNumber(),
                        (OuterJoinLoadable) locateOwningPersister()
                    ),
                    JoinHelper.getLHSColumnNames(
                        aType,
                        attributeNumber(),
                        columnPosition,
                        (OuterJoinLoadable) locateOwningPersister(),
                        sessionFactory()
                    )
                );
              }
              else if ( aType.getForeignKeyDirection() == ForeignKeyDirection.FOREIGN_KEY_FROM_PARENT ) {
                final String lhsTableName;
                final String[] lhsColumnNames;

                if ( joinable.isCollection() ) {
                  final QueryableCollection collectionPersister = (QueryableCollection) joinable;
                  lhsTableName = collectionPersister.getTableName();
                  lhsColumnNames = collectionPersister.getElementColumnNames();
                }
                else {
                  final OuterJoinLoadable entityPersister = (OuterJoinLoadable) locateOwningPersister();
                  lhsTableName = getLHSTableName( aType, attributeNumber(), entityPersister );
                  lhsColumnNames = getLHSColumnNames(
                      aType,
                      attributeNumber(),
                      columnPosition,
                      entityPersister,
                      sessionFactory()
                  );
                }
                associationKey = new AssociationKey( lhsTableName, lhsColumnNames );
              }
              else {
                associationKey = new AssociationKey(
                    joinable.getTableName(),
                    getRHSColumnNames( aType, sessionFactory() )
                );
              }
View Full Code Here


    pushToStack( entityReturn );

    // also add an AssociationKey for the root so we can later on recognize circular references back to the root.
    final Joinable entityPersister = (Joinable) entityDefinition.getEntityPersister();
    associationKeyRegistered(
        new AssociationKey( entityPersister.getTableName(), entityPersister.getKeyColumnNames() )
    );
  }
View Full Code Here

    final CollectionReturn collectionReturn = new CollectionReturnImpl( collectionDefinition, querySpaces );
    pushToCollectionStack( collectionReturn );
    addRootReturn( collectionReturn );

    associationKeyRegistered(
        new AssociationKey(
            ( (Joinable) collectionDefinition.getCollectionPersister() ).getTableName(),
            ( (Joinable) collectionDefinition.getCollectionPersister() ).getKeyColumnNames()
        )
    );
  }
View Full Code Here

    final FetchStrategy fetchStrategy = determineFetchStrategy( attributeDefinition );
    if ( fetchStrategy.getStyle() != FetchStyle.JOIN ) {
      return; // nothing to do
    }

    final AssociationKey associationKey = attributeDefinition.getAssociationKey();

    // go ahead and build the bidirectional fetch
    if ( attributeDefinition.getAssociationNature() == AssociationAttributeDefinition.AssociationNature.ENTITY ) {
      final Joinable currentEntityPersister = (Joinable) currentSource().resolveEntityReference().getEntityPersister();
      final AssociationKey currentEntityReferenceAssociationKey =
          new AssociationKey( currentEntityPersister.getTableName(), currentEntityPersister.getKeyColumnNames() );
      // if associationKey is equal to currentEntityReferenceAssociationKey
      // that means that the current EntityPersister has a single primary key attribute
      // (i.e., derived attribute) which is mapped by attributeDefinition.
      // This is not a bidirectional association.
      // TODO: AFAICT, to avoid an overflow, the associated entity must already be loaded into the session, or
View Full Code Here

            if ( type.isAssociationType() ) {
              final AssociationType aType = (AssociationType) type;
              return new AssociationAttributeDefinition() {
                @Override
                public AssociationKey getAssociationKey() {
                  return new AssociationKey( lhsTableName, subAttributeLhsColumns );
                }


                @Override
                public AssociationNature getAssociationNature() {
View Full Code Here

  @Override
  public AssociationKey getAssociationKey() {
    final AssociationType type = getType();

    if ( type.isAnyType() ) {
      return new AssociationKey(
          JoinHelper.getLHSTableName( type, attributeNumber(), (OuterJoinLoadable) getSource() ),
          JoinHelper.getLHSColumnNames(
              type,
              attributeNumber(),
              0,
              (OuterJoinLoadable) getSource(),
              sessionFactory()
          )
      );
    }

    final Joinable joinable = type.getAssociatedJoinable( sessionFactory() );

    if ( type.getForeignKeyDirection() == ForeignKeyDirection.FOREIGN_KEY_FROM_PARENT ) {
      final String lhsTableName;
      final String[] lhsColumnNames;

      if ( joinable.isCollection() ) {
        final QueryableCollection collectionPersister = (QueryableCollection) joinable;
        lhsTableName = collectionPersister.getTableName();
        lhsColumnNames = collectionPersister.getElementColumnNames();
      }
      else {
        final OuterJoinLoadable entityPersister = (OuterJoinLoadable) source();
        lhsTableName = getLHSTableName( type, attributeNumber(), entityPersister );
        lhsColumnNames = getLHSColumnNames( type, attributeNumber(), entityPersister, sessionFactory() );
      }
      return new AssociationKey( lhsTableName, lhsColumnNames );
    }
    else {
      return new AssociationKey( joinable.getTableName(), getRHSColumnNames( type, sessionFactory() ) );
    }
  }
View Full Code Here

    pushToStack( entityReturn );

    // also add an AssociationKey for the root so we can later on recognize circular references back to the root.
    final Joinable entityPersister = (Joinable) entityDefinition.getEntityPersister();
    associationKeyRegistered(
        new AssociationKey( entityPersister.getTableName(), entityPersister.getKeyColumnNames() )
    );
  }
View Full Code Here

    final CollectionReturn collectionReturn = new CollectionReturnImpl( collectionDefinition, querySpaces );
    pushToCollectionStack( collectionReturn );
    addRootReturn( collectionReturn );

    associationKeyRegistered(
        new AssociationKey(
            ( (Joinable) collectionDefinition.getCollectionPersister() ).getTableName(),
            ( (Joinable) collectionDefinition.getCollectionPersister() ).getKeyColumnNames()
        )
    );
  }
View Full Code Here

    final FetchStrategy fetchStrategy = determineFetchStrategy( attributeDefinition );
    if ( fetchStrategy.getStyle() != FetchStyle.JOIN ) {
      return; // nothing to do
    }

    final AssociationKey associationKey = attributeDefinition.getAssociationKey();

    // go ahead and build the bidirectional fetch
    if ( attributeDefinition.getAssociationNature() == AssociationAttributeDefinition.AssociationNature.ENTITY ) {
      final Joinable currentEntityPersister = (Joinable) currentSource().resolveEntityReference().getEntityPersister();
      final AssociationKey currentEntityReferenceAssociationKey =
          new AssociationKey( currentEntityPersister.getTableName(), currentEntityPersister.getKeyColumnNames() );
      // if associationKey is equal to currentEntityReferenceAssociationKey
      // that means that the current EntityPersister has a single primary key attribute
      // (i.e., derived attribute) which is mapped by attributeDefinition.
      // This is not a bidirectional association.
      // TODO: AFAICT, to avoid an overflow, the associated entity must already be loaded into the session, or
View Full Code Here

            int columnPosition = currentColumnPosition;
            currentColumnPosition += type.getColumnSpan( sessionFactory() );

            if ( type.isAssociationType() ) {
              // we build the association-key here because of the "goofiness" with 'currentColumnPosition'
              final AssociationKey associationKey;
              final AssociationType aType = (AssociationType) type;
              final Joinable joinable = aType.getAssociatedJoinable( sessionFactory() );

              if ( aType.isAnyType() ) {
                associationKey = new AssociationKey(
                    JoinHelper.getLHSTableName(
                        aType,
                        attributeNumber(),
                        (OuterJoinLoadable) locateOwningPersister()
                    ),
                    JoinHelper.getLHSColumnNames(
                        aType,
                        attributeNumber(),
                        columnPosition,
                        (OuterJoinLoadable) locateOwningPersister(),
                        sessionFactory()
                    )
                );
              }
              else if ( aType.getForeignKeyDirection() == ForeignKeyDirection.FOREIGN_KEY_FROM_PARENT ) {
                final String lhsTableName;
                final String[] lhsColumnNames;

                if ( joinable.isCollection() ) {
                  final QueryableCollection collectionPersister = (QueryableCollection) joinable;
                  lhsTableName = collectionPersister.getTableName();
                  lhsColumnNames = collectionPersister.getElementColumnNames();
                }
                else {
                  final OuterJoinLoadable entityPersister = (OuterJoinLoadable) locateOwningPersister();
                  lhsTableName = getLHSTableName( aType, attributeNumber(), entityPersister );
                  lhsColumnNames = getLHSColumnNames(
                      aType,
                      attributeNumber(),
                      columnPosition,
                      entityPersister,
                      sessionFactory()
                  );
                }
                associationKey = new AssociationKey( lhsTableName, lhsColumnNames );
              }
              else {
                associationKey = new AssociationKey(
                    joinable.getTableName(),
                    getRHSColumnNames( aType, sessionFactory() )
                );
              }
View Full Code Here

TOP

Related Classes of org.hibernate.persister.walking.spi.AssociationKey

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.