Package org.hibernate.persister.entity

Examples of org.hibernate.persister.entity.Joinable


    // property represents no association, so no inverse meta-data can exist
    if ( !propertyType.isAssociationType() ) {
      return null;
    }

    Joinable mainSideJoinable = ( (AssociationType) propertyType ).getAssociatedJoinable( factory );
    OgmEntityPersister inverseSidePersister = null;

    // to-many association
    if ( mainSideJoinable.isCollection() ) {
      inverseSidePersister = (OgmEntityPersister) ( (OgmCollectionPersister) mainSideJoinable ).getElementPersister();
    }
    // to-one
    else {
      inverseSidePersister = (OgmEntityPersister) mainSideJoinable;
View Full Code Here


    for ( String property : getPropertyNames() ) {
      Type propertyType = getPropertyType( property );

      if ( propertyType.isAssociationType() ) {
        Joinable associatedJoinable = ( (AssociationType) propertyType ).getAssociatedJoinable( getFactory() );

        // *-to-many
        if ( associatedJoinable.isCollection() ) {
          OgmCollectionPersister inversePersister = (OgmCollectionPersister) associatedJoinable;

          if ( gridDialect.isStoredInEntityStructure( inversePersister.getAssociationKeyMetadata(), inversePersister.getAssociationTypeContext( property ) ) ) {
            embeddedCollections.add( property );
          }
View Full Code Here

    if ( subgraphMap == null ) {
      subgraphMap = new HashMap<Class, Subgraph>();
    }

    final AssociationType attributeType = (AssociationType) Helper.resolveType( sessionFactory(), attribute );
    final Joinable joinable = attributeType.getAssociatedJoinable( sessionFactory() );

    if ( joinable.isCollection() ) {
      final EntityPersister elementEntityPersister = ( (QueryableCollection) joinable ).getElementPersister();
      if ( type == null ) {
        type = elementEntityPersister.getMappedClass();
      }
      else  {
View Full Code Here

    }
    element.initializeEntity( fromClause, className, entityPersister, type, classAlias, tableAlias );
  }

  private FromElement createFromElement(EntityPersister entityPersister) {
    Joinable joinable = ( Joinable ) entityPersister;
    String text = joinable.getTableName();
    AST ast = createFromElement( text );
    FromElement element = ( FromElement ) ast;
    return element;
  }
View Full Code Here

      return joinSequence;
    }

    // Class names in the FROM clause result in a JoinSequence (the old FromParser does this).
    if ( persister instanceof Joinable ) {
      Joinable joinable = ( Joinable ) persister;
      return fromElement.getSessionFactoryHelper().createJoinSequence().setRoot( joinable, getTableAlias() );
    }
    else {
      return null// TODO: Should this really return null?  If not, figure out something better to do here.
    }
View Full Code Here

      if (includeExtraJoins) { //TODO: not quite sure about the full implications of this!
        addExtraJoins( joinFragment, rootAlias, rootJoinable, true );
      }
    }

    Joinable last = rootJoinable;

    for ( int i = 0; i < joins.size(); i++ ) {
      Join join = ( Join ) joins.get( i );
      String on = join.getAssociationType().getOnCondition( join.getAlias(), factory, enabledFilters );
      String condition = null;
View Full Code Here

      return joinSequence;
    }

    // Class names in the FROM clause result in a JoinSequence (the old FromParser does this).
    if ( persister instanceof Joinable ) {
      Joinable joinable = ( Joinable ) persister;
      return fromElement.getSessionFactoryHelper().createJoinSequence().setRoot( joinable, getTableAlias() );
    }
    else {
      return null// TODO: Should this really return null?  If not, figure out something better to do here.
    }
View Full Code Here

            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() )
                );
              }

              final CompositeType cType = getType();
View Full Code Here

    final EntityReturnImpl entityReturn = new EntityReturnImpl( entityDefinition, querySpaces );
    addRootReturn( entityReturn );
    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 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

TOP

Related Classes of org.hibernate.persister.entity.Joinable

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.