org.hibernate.mapping.Column.setSqlType()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(10.4k)|赞(0)|评价(0)|浏览(115)

本文整理了Java中org.hibernate.mapping.Column.setSqlType()方法的一些代码示例,展示了Column.setSqlType()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Column.setSqlType()方法的具体详情如下:
包路径:org.hibernate.mapping.Column
类名称:Column
方法名:setSqlType

Column.setSqlType介绍

暂无

代码示例

代码示例来源:origin: hibernate/hibernate-orm

@Override
protected void augmentIdTableDefinition(Table idTable) {
  Column sessionIdColumn = new Column( Helper.SESSION_ID_COLUMN_NAME );
  sessionIdColumn.setSqlType( "CHAR(36)" );
  sessionIdColumn.setComment( "Used to hold the Hibernate Session identifier" );
  idTable.addColumn( sessionIdColumn );
}

代码示例来源:origin: hibernate/hibernate-orm

/**
 * Shallow copy, the value is not copied
 */
@Override
public Column clone() {
  Column copy = new Column();
  copy.setLength( length );
  copy.setScale( scale );
  copy.setValue( value );
  copy.setTypeIndex( typeIndex );
  copy.setName( getQuotedName() );
  copy.setNullable( nullable );
  copy.setPrecision( precision );
  copy.setUnique( unique );
  copy.setSqlType( sqlType );
  copy.setSqlTypeCode( sqlTypeCode );
  copy.uniqueInteger = uniqueInteger; //usually useless
  copy.setCheckConstraint( checkConstraint );
  copy.setComment( comment );
  copy.setDefaultValue( defaultValue );
  copy.setCustomRead( customRead );
  copy.setCustomWrite( customWrite );
  return copy;
}

代码示例来源:origin: hibernate/hibernate-orm

this.mappingColumn.setSqlType( sqlType );
this.mappingColumn.setUnique( unique );

代码示例来源:origin: hibernate/hibernate-orm

/**
 * Called to apply column definitions from the referenced FK column to this column.
 *
 * @param column the referenced column.
 */
public void overrideFromReferencedColumnIfNecessary(org.hibernate.mapping.Column column) {
  if (getMappingColumn() != null) {
    // columnDefinition can also be specified using @JoinColumn, hence we have to check
    // whether it is set or not
    if ( StringHelper.isEmpty( sqlType ) ) {
      sqlType = column.getSqlType();
      getMappingColumn().setSqlType( sqlType );
    }
    // these properties can only be applied on the referenced column - we can just take them over
    getMappingColumn().setLength(column.getLength());
    getMappingColumn().setPrecision(column.getPrecision());
    getMappingColumn().setScale(column.getScale());
  }
}

代码示例来源:origin: hibernate/hibernate-orm

copy.setPrecision( column.getPrecision() );
copy.setUnique( column.isUnique() );
copy.setSqlType( column.getSqlType() );
copy.setCheckConstraint( column.getCheckConstraint() );
copy.setComment( column.getComment() );

代码示例来源:origin: hibernate/hibernate-orm

copy.setPrecision( column.getPrecision() );
copy.setUnique( column.isUnique() );
copy.setSqlType( column.getSqlType() );
copy.setCheckConstraint( column.getCheckConstraint() );
copy.setComment( column.getComment() );

代码示例来源:origin: hibernate/hibernate-orm

column.setSqlType( columnSource.getSqlType() );

代码示例来源:origin: org.hibernate/hibernate-annotations

protected void initMappingColumn(
    String columnName,
    String propertyName,
    int length,
    int precision,
    int scale,
    boolean nullable,
    String sqlType,
    boolean unique,
    boolean applyNamingStrategy) {
  if ( StringHelper.isNotEmpty( formulaString ) ) {
    this.formula = new Formula();
    this.formula.setFormula( formulaString );
  }
  else {
    this.mappingColumn = new Column();
    redefineColumnName( columnName, propertyName, applyNamingStrategy );
    this.mappingColumn.setLength( length );
    if ( precision > 0 ) {  //revelent precision
      this.mappingColumn.setPrecision( precision );
      this.mappingColumn.setScale( scale );
    }
    this.mappingColumn.setNullable( nullable );
    this.mappingColumn.setSqlType( sqlType );
    this.mappingColumn.setUnique( unique );
  }
}

代码示例来源:origin: org.hibernate/hibernate-annotations

/**
 * Called to apply column definitions from the referenced FK column to this column.
 * 
 * @param column the referenced column.
 */
public void overrideFromReferencedColumnIfNecessary(org.hibernate.mapping.Column column) {
  
  if (getMappingColumn() != null) {
    // columnDefinition can also be specified using @JoinColumn, hence we have to check
    // whether it is set or not
    if ( StringHelper.isEmpty( sqlType ) ) {
      sqlType = column.getSqlType();
      getMappingColumn().setSqlType( sqlType );
    }
    // these properties can only be applied on the referenced column - we can just take them over
    getMappingColumn().setLength(column.getLength());
    getMappingColumn().setPrecision(column.getPrecision());
    getMappingColumn().setScale(column.getScale());
  }
}

代码示例来源:origin: org.hibernate/hibernate-annotations

copy.setPrecision( column.getPrecision() );
copy.setUnique( column.isUnique() );
copy.setSqlType( column.getSqlType() );
copy.setCheckConstraint( column.getCheckConstraint() );
copy.setComment( column.getComment() );

代码示例来源:origin: jboss.jboss-embeddable-ejb3/hibernate-all

public void overrideSqlTypeIfNecessary(org.hibernate.mapping.Column column) {
  if ( StringHelper.isEmpty( sqlType ) ) {
    sqlType = column.getSqlType();
    if ( getMappingColumn() != null ) getMappingColumn().setSqlType( sqlType );
  }
}

代码示例来源:origin: org.hibernate/hibernate-annotations

copy.setPrecision( column.getPrecision() );
copy.setUnique( column.isUnique() );
copy.setSqlType( column.getSqlType() );
copy.setCheckConstraint( column.getCheckConstraint() );
copy.setComment( column.getComment() );

代码示例来源:origin: hibernate/hibernate

public static void bindColumn(Element node, Column column, boolean isNullable) {
  Attribute lengthNode = node.attribute( "length" );
  if ( lengthNode != null ) column.setLength( Integer.parseInt( lengthNode.getValue() ) );
  Attribute scalNode = node.attribute( "scale" );
  if ( scalNode != null ) column.setScale( Integer.parseInt( scalNode.getValue() ) );
  Attribute precNode = node.attribute( "precision" );
  if ( precNode != null ) column.setPrecision( Integer.parseInt( precNode.getValue() ) );
  Attribute nullNode = node.attribute( "not-null" );
  column.setNullable( nullNode == null ? isNullable : nullNode.getValue().equals( "false" ) );
  Attribute unqNode = node.attribute( "unique" );
  if ( unqNode != null ) column.setUnique( unqNode.getValue().equals( "true" ) );
  column.setCheckConstraint( node.attributeValue( "check" ) );
  Attribute typeNode = node.attribute( "sql-type" );
  if ( typeNode != null ) column.setSqlType( typeNode.getValue() );
  Element comment = node.element("comment");
  if (comment!=null) column.setComment( comment.getTextTrim() );

}

代码示例来源:origin: jboss.jboss-embeddable-ejb3/hibernate-all

protected void initMappingColumn(
    String columnName, String propertyName, int length, int precision, int scale, boolean nullable,
    String sqlType, boolean unique, boolean applyNamingStrategy
) {
  this.mappingColumn = new Column();
  redefineColumnName( columnName, propertyName, applyNamingStrategy );
  this.mappingColumn.setLength( length );
  if ( precision > 0 ) {  //revelent precision
    this.mappingColumn.setPrecision( precision );
    this.mappingColumn.setScale( scale );
  }
  this.mappingColumn.setNullable( nullable );
  this.mappingColumn.setSqlType( sqlType );
  this.mappingColumn.setUnique( unique );
}

代码示例来源:origin: org.grails/grails-hibernate

private static void bindColumnConfigToColumn(Column column, ColumnConfig columnConfig) {
  if (columnConfig == null) {
    return;
  }
  if (columnConfig.getLength() != -1) {
    column.setLength(columnConfig.getLength());
  }
  if (columnConfig.getPrecision() != -1) {
    column.setPrecision(columnConfig.getPrecision());
  }
  if (columnConfig.getScale() != -1) {
    column.setScale(columnConfig.getScale());
  }
  if (columnConfig.getSqlType() != null && !columnConfig.getSqlType().isEmpty()) {
    column.setSqlType(columnConfig.getSqlType());
  }
  column.setUnique(columnConfig.getUnique());
}

代码示例来源:origin: org.grails/grails-datastore-gorm-hibernate-core

protected void linkValueUsingAColumnCopy(PersistentProperty prop, Column column, DependantValue key) {
  Column mappingColumn = new Column();
  mappingColumn.setName(column.getName());
  mappingColumn.setLength(column.getLength());
  mappingColumn.setNullable(prop.isNullable());
  mappingColumn.setSqlType(column.getSqlType());
  mappingColumn.setValue(key);
  key.addColumn(mappingColumn);
  key.getTable().addColumn(mappingColumn);
}

代码示例来源:origin: org.grails/grails-hibernate

private static void linkValueUsingAColumnCopy(GrailsDomainClassProperty prop, Column column, DependantValue key) {
  Column mappingColumn = new Column();
  mappingColumn.setName(column.getName());
  mappingColumn.setLength(column.getLength());
  mappingColumn.setNullable(prop.isOptional());
  mappingColumn.setSqlType(column.getSqlType());
  mappingColumn.setValue(key);
  key.addColumn(mappingColumn);
  key.getTable().addColumn(mappingColumn);
}

代码示例来源:origin: org.hibernate.orm/hibernate-core

/**
 * Called to apply column definitions from the referenced FK column to this column.
 *
 * @param column the referenced column.
 */
public void overrideFromReferencedColumnIfNecessary(org.hibernate.mapping.Column column) {
  if (getMappingColumn() != null) {
    // columnDefinition can also be specified using @JoinColumn, hence we have to check
    // whether it is set or not
    if ( StringHelper.isEmpty( sqlType ) ) {
      sqlType = column.getSqlType();
      getMappingColumn().setSqlType( sqlType );
    }
    // these properties can only be applied on the referenced column - we can just take them over
    getMappingColumn().setLength(column.getLength());
    getMappingColumn().setPrecision(column.getPrecision());
    getMappingColumn().setScale(column.getScale());
  }
}

代码示例来源:origin: org.hibernate/com.springsource.org.hibernate.core

/**
 * Called to apply column definitions from the referenced FK column to this column.
 *
 * @param column the referenced column.
 */
public void overrideFromReferencedColumnIfNecessary(org.hibernate.mapping.Column column) {
  if (getMappingColumn() != null) {
    // columnDefinition can also be specified using @JoinColumn, hence we have to check
    // whether it is set or not
    if ( StringHelper.isEmpty( sqlType ) ) {
      sqlType = column.getSqlType();
      getMappingColumn().setSqlType( sqlType );
    }
    // these properties can only be applied on the referenced column - we can just take them over
    getMappingColumn().setLength(column.getLength());
    getMappingColumn().setPrecision(column.getPrecision());
    getMappingColumn().setScale(column.getScale());
  }
}

代码示例来源:origin: jboss.jboss-embeddable-ejb3/hibernate-all

public static void bindColumn(Element node, Column column, boolean isNullable) {
  Attribute lengthNode = node.attribute( "length" );
  if ( lengthNode != null ) column.setLength( Integer.parseInt( lengthNode.getValue() ) );
  Attribute scalNode = node.attribute( "scale" );
  if ( scalNode != null ) column.setScale( Integer.parseInt( scalNode.getValue() ) );
  Attribute precNode = node.attribute( "precision" );
  if ( precNode != null ) column.setPrecision( Integer.parseInt( precNode.getValue() ) );
  Attribute nullNode = node.attribute( "not-null" );
  column.setNullable( nullNode == null ? isNullable : nullNode.getValue().equals( "false" ) );
  Attribute unqNode = node.attribute( "unique" );
  if ( unqNode != null ) column.setUnique( unqNode.getValue().equals( "true" ) );
  column.setCheckConstraint( node.attributeValue( "check" ) );
  column.setDefaultValue( node.attributeValue( "default" ) );
  Attribute typeNode = node.attribute( "sql-type" );
  if ( typeNode != null ) column.setSqlType( typeNode.getValue() );
  Element comment = node.element("comment");
  if (comment!=null) column.setComment( comment.getTextTrim() );
}

相关文章