Package org.hibernate.mapping

Examples of org.hibernate.mapping.Column


  private String stringValue(BigInteger number) {
    return number.abs().toString();
  }

  public void apply(Property property) {
    Column col = (Column) property.getColumnIterator().next();
    col.setPrecision( integerDigits + fractionalDigits );
    col.setScale( fractionalDigits );
  }
View Full Code Here


      return false;
    }
  }

  public void apply(Property property) {
    Column col = (Column) property.getColumnIterator().next();
    col.setCheckConstraint( col.getName() + "<=" + max );
  }
View Full Code Here

    int length = string.length();
    return length >= min && length <= max;
  }

  public void apply(Property property) {
    Column col = (Column) property.getColumnIterator().next();
    if ( max < Integer.MAX_VALUE ) col.setLength( max );
  }
View Full Code Here

      return false;
    }
  }

  public void apply(Property property) {
    Column col = (Column) property.getColumnIterator().next();
    col.setCheckConstraint( col.getName() + ">=" + min );
  }
View Full Code Here

        }
        else {
          fkRefs = fk.getReferencedColumns();       
        }
        for (int i = 0; i < fk.getColumnSpan(); i++) {
          Column column = fk.getColumn(i);
          Column ref = (Column) fkRefs.get(i);
          if (!hasReference(column, ref)) {
            return false;
          }
        }
        return true;
View Full Code Here

      if ( !table.isAbstractUnionTable() ) {
        //TODO: move to .sql package!!
        buf.append("select ");
        Iterator citer = columns.iterator();
        while ( citer.hasNext() ) {
          Column col = (Column) citer.next();
          if ( !table.containsColumn(col) ) {
            int sqlType = col.getSqlTypeCode(mapping);
            buf.append( dialect.getSelectClauseNullString(sqlType) )
              .append(" as ");
          }
          buf.append( col.getName() );
          buf.append(", ");
        }
        buf.append( clazz.getSubclassId() )
          .append(" as clazz_");
        buf.append(" from ")
View Full Code Here

  private String stringValue(BigInteger number) {
    return number.abs().toString();
  }

  public void apply(Property property) {
    Column col = (Column) property.getColumnIterator().next();
    col.setPrecision( integerDigits + fractionalDigits );
    col.setScale( fractionalDigits );
  }
View Full Code Here

      return false;
    }
  }

  public void apply(Property property) {
    Column col = (Column) property.getColumnIterator().next();
    col.setCheckConstraint( col.getName() + "<=" + max );
  }
View Full Code Here

    int length = string.length();
    return length >= min && length <= max;
  }

  public void apply(Property property) {
    Column col = (Column) property.getColumnIterator().next();
    if ( max < Integer.MAX_VALUE ) col.setLength( max );
  }
View Full Code Here

      Iterator iter = join.getKey().getColumnIterator();
      keyColumnNames[j] = new String[ join.getKey().getColumnSpan() ];
      int i = 0;
      while ( iter.hasNext() ) {
        Column col = (Column) iter.next();
        keyColumnNames[j][i++] = col.getQuotedName( factory.getDialect() );
      }

      j++;
    }

    constraintOrderedTableNames = new String[qualifiedTableNames.length];
    constraintOrderedKeyColumnNames = new String[qualifiedTableNames.length][];
    for ( int i = qualifiedTableNames.length - 1, position = 0; i >= 0; i--, position++ ) {
      constraintOrderedTableNames[position] = qualifiedTableNames[i];
      constraintOrderedKeyColumnNames[position] = keyColumnNames[i];
    }

    spaces = ArrayHelper.join(
        qualifiedTableNames,
        ArrayHelper.toStringArray( persistentClass.getSynchronizedTables() )
    );
   
    final boolean lazyAvailable = isInstrumented(EntityMode.POJO);

    boolean hasDeferred = false;
    ArrayList subclassTables = new ArrayList();
    ArrayList joinKeyColumns = new ArrayList();
    ArrayList isConcretes = new ArrayList();
    ArrayList isDeferreds = new ArrayList();
    ArrayList isInverses = new ArrayList();
    ArrayList isNullables = new ArrayList();
    ArrayList isLazies = new ArrayList();
    subclassTables.add( qualifiedTableNames[0] );
    joinKeyColumns.add( getIdentifierColumnNames() );
    isConcretes.add(Boolean.TRUE);
    isDeferreds.add(Boolean.FALSE);
    isInverses.add(Boolean.FALSE);
    isNullables.add(Boolean.FALSE);
    isLazies.add(Boolean.FALSE);
    joinIter = persistentClass.getSubclassJoinClosureIterator();
    while ( joinIter.hasNext() ) {
      Join join = (Join) joinIter.next();
      isConcretes.add( new Boolean( persistentClass.isClassOrSuperclassJoin(join) ) );
      isDeferreds.add( new Boolean( join.isSequentialSelect() ) );
      isInverses.add( new Boolean( join.isInverse() ) );
      isNullables.add( new Boolean( join.isOptional() ) );
      isLazies.add( new Boolean( lazyAvailable && join.isLazy() ) );
      if ( join.isSequentialSelect() && !persistentClass.isClassOrSuperclassJoin(join) ) hasDeferred = true;
      subclassTables.add( join.getTable().getQualifiedName(
          factory.getDialect(),
          factory.getSettings().getDefaultCatalogName(),
          factory.getSettings().getDefaultSchemaName()
      ) );
      Iterator iter = join.getKey().getColumnIterator();
      String[] keyCols = new String[ join.getKey().getColumnSpan() ];
      int i = 0;
      while ( iter.hasNext() ) {
        Column col = (Column) iter.next();
        keyCols[i++] = col.getQuotedName( factory.getDialect() );
      }
      joinKeyColumns.add(keyCols);
    }
   
    subclassTableSequentialSelect = ArrayHelper.toBooleanArray(isDeferreds);
    subclassTableNameClosure = ArrayHelper.toStringArray(subclassTables);
    subclassTableIsLazyClosure = ArrayHelper.toBooleanArray(isLazies);
    subclassTableKeyColumnClosure = ArrayHelper.to2DStringArray(joinKeyColumns);
    isClassOrSuperclassTable = ArrayHelper.toBooleanArray(isConcretes);
    isInverseSubclassTable = ArrayHelper.toBooleanArray(isInverses);
    isNullableSubclassTable = ArrayHelper.toBooleanArray(isNullables);
    hasSequentialSelects = hasDeferred;

    // DISCRIMINATOR

    final Object discriminatorValue;
    if ( persistentClass.isPolymorphic() ) {
      Value discrimValue = persistentClass.getDiscriminator();
      if (discrimValue==null) {
        throw new MappingException("discriminator mapping required for single table polymorphic persistence");
      }
      forceDiscriminator = persistentClass.isForceDiscriminator();
      Selectable selectable = (Selectable) discrimValue.getColumnIterator().next();
      if ( discrimValue.hasFormula() ) {
        Formula formula = (Formula) selectable;
        discriminatorFormula = formula.getFormula();
        discriminatorFormulaTemplate = formula.getTemplate( factory.getDialect(), factory.getSqlFunctionRegistry() );
        discriminatorColumnName = null;
        discriminatorAlias = "clazz_";
      }
      else {
        Column column = (Column) selectable;
        discriminatorColumnName = column.getQuotedName( factory.getDialect() );
        discriminatorAlias = column.getAlias( factory.getDialect(), persistentClass.getRootTable() );
        discriminatorFormula = null;
        discriminatorFormulaTemplate = null;
      }
      discriminatorType = persistentClass.getDiscriminator().getType();
      if ( persistentClass.isDiscriminatorValueNull() ) {
View Full Code Here

TOP

Related Classes of org.hibernate.mapping.Column

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.