Package org.hibernate.metamodel.relational

Examples of org.hibernate.metamodel.relational.Column


      LOG.noColumnsSpecifiedForIndex( indexName, table.toLoggableString() );
      return;
    }
    org.hibernate.metamodel.relational.Index index = table.getOrCreateIndex( indexName );
    for ( String columnName : columnNames ) {
      Column column = findColumn( table, columnName );
      if ( column == null ) {
        throw new AnnotationException( "@Index references a unknown column: " + columnName );
      }
      index.addColumn( column );
    }
View Full Code Here


      index.addColumn( column );
    }
  }

  private static Column findColumn(Table table, String columnName) {
    Column column = null;
    for ( SimpleValue value : table.values() ) {
      if ( value instanceof Column && ( (Column) value ).getColumnName().getName().equals( columnName ) ) {
        column = (Column) value;
        break;
      }
View Full Code Here

        final TableSpecification table = attributeBinding.getEntityBinding()
            .getTable( valueSource.getContainingTableName() );

        if ( ColumnSource.class.isInstance( valueSource ) ) {
          final ColumnSource columnSource = ColumnSource.class.cast( valueSource );
          final Column column = table.locateOrCreateColumn( columnSource.getName() );
          column.setNullable( columnSource.isNullable() );
          column.setDefaultValue( columnSource.getDefaultValue() );
          column.setSqlType( columnSource.getSqlType() );
          column.setSize( columnSource.getSize() );
          column.setDatatype( columnSource.getDatatype() );
          column.setReadFragment( columnSource.getReadFragment() );
          column.setWriteFragment( columnSource.getWriteFragment() );
          column.setUnique( columnSource.isUnique() );
          column.setCheckCondition( columnSource.getCheckCondition() );
          column.setComment( columnSource.getComment() );
          valueBindings.add(
              new SimpleValueBinding(
                  column,
                  columnSource.isIncludedInInsert(),
                  columnSource.isIncludedInUpdate()
View Full Code Here

      throw new IllegalArgumentException( "columnName must be non-null." );
    }
        if ( state.isGloballyQuotedIdentifiers() ) {
            columnName = StringHelper.quote( columnName );
        }
    Column value = table.locateOrCreateColumn( columnName );
    value.initialize( state, forceNonNullable, forceUnique );
    return value;
  }
View Full Code Here

  public boolean isNullable() {
    for ( SimpleValue simpleValue : getValues() ) {
      if ( simpleValue instanceof DerivedValue ) {
        return true;
      }
      Column column = (Column) simpleValue;
      if ( column.isNullable() ) {
        return true;
      }
    }
    return false;
  }
View Full Code Here

//      mappings.addColumnBinding( logicalColumnName, column, table );

    if ( columnName == null ) {
      throw new IllegalArgumentException( "columnName must be non-null." );
    }
    Column value = table.getOrCreateColumn( columnName );
    value.initialize( state, forceNonNullable, forceUnique );
    return value;
  }
View Full Code Here

            .seekEntityBinding()
            .locateTable( valueSource.getContainingTableName() );

        if ( ColumnSource.class.isInstance( valueSource ) ) {
          final ColumnSource columnSource = ColumnSource.class.cast( valueSource );
          final Column column = makeColumn( (ColumnSource) valueSource, table );
          valueBindings.add(
              new SimpleValueBinding(
                  column,
                  columnSource.isIncludedInInsert(),
                  columnSource.isIncludedInUpdate()
              )
          );
        }
        else {
          valueBindings.add(
              new SimpleValueBinding(
                  makeDerivedValue( ( (DerivedValueSource) valueSource ), table )
              )
          );
        }
      }
    }
    else {
      String name = metadata.getOptions()
          .getNamingStrategy()
          .propertyToColumnName( attributeBinding.getAttribute().getName() );
      name = quoteIdentifier( name );
      Column column = attributeBinding.getContainer()
                  .seekEntityBinding()
                  .getPrimaryTable()
                  .locateOrCreateColumn( name );
      column.setNullable( relationalValueSourceContainer.areValuesNullableByDefault() );
      valueBindings.add(
          new SimpleValueBinding(
              column,
              relationalValueSourceContainer.areValuesIncludedInInsertByDefault(),
              relationalValueSourceContainer.areValuesIncludedInUpdateByDefault()
View Full Code Here

  private Column makeColumn(ColumnSource columnSource, TableSpecification table) {
    String name = columnSource.getName();
    name = metadata.getOptions().getNamingStrategy().columnName( name );
    name = quoteIdentifier( name );
    final Column column = table.locateOrCreateColumn( name );
    column.setNullable( columnSource.isNullable() );
    column.setDefaultValue( columnSource.getDefaultValue() );
    column.setSqlType( columnSource.getSqlType() );
    column.setSize( columnSource.getSize() );
    column.setDatatype( columnSource.getDatatype() );
    column.setReadFragment( columnSource.getReadFragment() );
    column.setWriteFragment( columnSource.getWriteFragment() );
    column.setUnique( columnSource.isUnique() );
    column.setCheckCondition( columnSource.getCheckCondition() );
    column.setComment( columnSource.getComment() );
    return column;
  }
View Full Code Here

            .seekEntityBinding()
            .locateTable( valueSource.getContainingTableName() );

        if ( ColumnSource.class.isInstance( valueSource ) ) {
          final ColumnSource columnSource = ColumnSource.class.cast( valueSource );
          final Column column = makeColumn( (ColumnSource) valueSource, table );
          valueBindings.add(
              new SimpleValueBinding(
                  column,
                  columnSource.isIncludedInInsert(),
                  columnSource.isIncludedInUpdate()
View Full Code Here

  private Column makeColumn(ColumnSource columnSource, TableSpecification table) {
    String name = columnSource.getName();
    name = metadata.getOptions().getNamingStrategy().columnName( name );
    name = quoteIdentifier( name );
    final Column column = table.locateOrCreateColumn( name );
    column.setNullable( columnSource.isNullable() );
    column.setDefaultValue( columnSource.getDefaultValue() );
    column.setSqlType( columnSource.getSqlType() );
    column.setSize( columnSource.getSize() );
    column.setDatatype( columnSource.getDatatype() );
    column.setReadFragment( columnSource.getReadFragment() );
    column.setWriteFragment( columnSource.getWriteFragment() );
    column.setUnique( columnSource.isUnique() );
    column.setCheckCondition( columnSource.getCheckCondition() );
    column.setComment( columnSource.getComment() );
    return column;
  }
View Full Code Here

TOP

Related Classes of org.hibernate.metamodel.relational.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.