Examples of AssociationType


Examples of org.hibernate.type.AssociationType

   */
  public int getSubclassPropertyTableNumber(String propertyPath) {
    String rootPropertyName = StringHelper.root(propertyPath);
    Type type = propertyMapping.toType(rootPropertyName);
    if ( type.isAssociationType() ) {
      AssociationType assocType = ( AssociationType ) type;
      if ( assocType.useLHSPrimaryKey() ) {
        // performance op to avoid the array search
        return 0;
      }
      else if ( type.isCollectionType() ) {
        // properly handle property-ref-based associations
        rootPropertyName = assocType.getLHSPropertyName();
      }
    }
    //Enable for HHH-440, which we don't like:
    /*if ( type.isComponentType() && !propertyName.equals(rootPropertyName) ) {
      String unrooted = StringHelper.unroot(propertyName);
View Full Code Here

Examples of org.hibernate.type.AssociationType

          " of: " + getEntityName()
        );
    }

    if ( type.isAssociationType() ) {
      AssociationType actype = (AssociationType) type;
      if ( actype.useLHSPrimaryKey() ) {
        columns = getIdentifierColumnNames();
        columnReaders = getIdentifierColumnReaders();
        columnReaderTemplates = getIdentifierColumnReaderTemplates();
      }
      else {
        String foreignKeyProperty = actype.getLHSPropertyName();
        if ( foreignKeyProperty!=null && !path.equals(foreignKeyProperty) ) {
          //TODO: this requires that the collection is defined after the
          //      referenced property in the mapping file (ok?)
          columns = (String[]) columnsByPropertyPath.get(foreignKeyProperty);
          if (columns==null) return; //get em on the second pass!
          columnReaders = (String[]) columnReadersByPropertyPath.get(foreignKeyProperty);
          columnReaderTemplates = (String[]) columnReaderTemplatesByPropertyPath.get(foreignKeyProperty);
        }
      }
    }

    if (path!=null) addPropertyPath(path, type, columns, columnReaders, columnReaderTemplates, formulaTemplates);

    if ( type.isComponentType() ) {
      AbstractComponentType actype = (AbstractComponentType) type;
      initComponentPropertyPaths( path, actype, columns, columnReaders, columnReaderTemplates, formulaTemplates, factory );
      if ( actype.isEmbedded() ) {
        initComponentPropertyPaths(
            path==null ? null : StringHelper.qualifier(path),
            actype,
            columns,
            columnReaders,
View Full Code Here

Examples of org.hibernate.type.AssociationType

      final Object anything,
      final boolean isCascadeDeleteEnabled) throws HibernateException {

    if (child!=null) {
      if ( type.isAssociationType() ) {
        AssociationType associationType = (AssociationType) type;
        if ( cascadeAssociationNow( associationType ) ) {
          cascadeAssociation(
              parent,
              child,
              type,
View Full Code Here

Examples of org.hibernate.type.AssociationType

    String componentPath = "";
    while ( tokens.hasMoreTokens() ) {
      componentPath += tokens.nextToken();
      Type type = persister.toType( componentPath );
      if ( type.isAssociationType() ) {
        AssociationType atype = ( AssociationType ) type;
        persister = ( Queryable ) sessionFactory.getEntityPersister(
            atype.getAssociatedEntityName( sessionFactory )
        );
        componentPath = "";
      }
      else if ( type.isComponentType() ) {
        componentPath += '.';
View Full Code Here

Examples of org.hibernate.type.AssociationType

          String collectionSuffix,
          boolean includeCollectionColumns) {
    // we need to determine the best way to know that two joinables
    // represent a single many-to-many...
    if ( rhs != null && isManyToMany() && !rhs.isCollection() ) {
      AssociationType elementType = ( ( AssociationType ) getElementType() );
      if ( rhs.equals( elementType.getAssociatedJoinable( getFactory() ) ) ) {
        return manyToManySelectFragment( rhs, rhsAlias, lhsAlias, collectionSuffix );
      }
    }
    return includeCollectionColumns ? selectFragment( lhsAlias, collectionSuffix ) : "";
  }
View Full Code Here

Examples of org.hibernate.type.AssociationType

    }
  }

  private static NonIdentifierAttributeNature decode(Type type) {
    if ( type.isAssociationType() ) {
      AssociationType associationType = (AssociationType) type;

      if ( type.isComponentType() ) {
        // an any type is both an association and a composite...
        return NonIdentifierAttributeNature.ANY;
      }
View Full Code Here

Examples of org.hibernate.type.AssociationType

            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;
View Full Code Here

Examples of org.hibernate.type.AssociationType

          " of: " + getEntityName()
        );
    }

    if ( type.isAssociationType() ) {
      AssociationType actype = (AssociationType) type;
      if ( actype.useLHSPrimaryKey() ) {
        columns = getIdentifierColumnNames();
        columnReaders = getIdentifierColumnReaders();
        columnReaderTemplates = getIdentifierColumnReaderTemplates();
      }
      else {
        String foreignKeyProperty = actype.getLHSPropertyName();
        if ( foreignKeyProperty!=null && !path.equals(foreignKeyProperty) ) {
          //TODO: this requires that the collection is defined after the
          //      referenced property in the mapping file (ok?)
          columns = (String[]) columnsByPropertyPath.get(foreignKeyProperty);
          if (columns==null) return; //get em on the second pass!
          columnReaders = (String[]) columnReadersByPropertyPath.get(foreignKeyProperty);
          columnReaderTemplates = (String[]) columnReaderTemplatesByPropertyPath.get(foreignKeyProperty);
        }
      }
    }

    if (path!=null) addPropertyPath(path, type, columns, columnReaders, columnReaderTemplates, formulaTemplates);

    if ( type.isComponentType() ) {
      CompositeType actype = (CompositeType) type;
      initComponentPropertyPaths( path, actype, columns, columnReaders, columnReaderTemplates, formulaTemplates, factory );
      if ( actype.isEmbedded() ) {
        initComponentPropertyPaths(
            path==null ? null : StringHelper.qualifier(path),
            actype,
            columns,
            columnReaders,
View Full Code Here

Examples of org.hibernate.type.AssociationType

          String collectionSuffix,
          boolean includeCollectionColumns) {
    // we need to determine the best way to know that two joinables
    // represent a single many-to-many...
    if ( rhs != null && isManyToMany() && !rhs.isCollection() ) {
      AssociationType elementType = ( ( AssociationType ) getElementType() );
      if ( rhs.equals( elementType.getAssociatedJoinable( getFactory() ) ) ) {
        return manyToManySelectFragment( rhs, rhsAlias, lhsAlias, collectionSuffix );
      }
    }
    return includeCollectionColumns ? selectFragment( lhsAlias, collectionSuffix ) : "";
  }
View Full Code Here

Examples of org.hibernate.type.AssociationType

   */
  public int getSubclassPropertyTableNumber(String propertyPath) {
    String rootPropertyName = StringHelper.root(propertyPath);
    Type type = propertyMapping.toType(rootPropertyName);
    if ( type.isAssociationType() ) {
      AssociationType assocType = ( AssociationType ) type;
      if ( assocType.useLHSPrimaryKey() ) {
        // performance op to avoid the array search
        return 0;
      }
      else if ( type.isCollectionType() ) {
        // properly handle property-ref-based associations
        rootPropertyName = assocType.getLHSPropertyName();
      }
    }
    //Enable for HHH-440, which we don't like:
    /*if ( type.isComponentType() && !propertyName.equals(rootPropertyName) ) {
      String unrooted = StringHelper.unroot(propertyName);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.