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

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

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

Column.setCheckConstraint介绍

暂无

代码示例

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

private static void applySQLCheck(Column col, String checkConstraint) {
  String existingCheck = col.getCheckConstraint();
  // need to check whether the new check is already part of the existing check, because applyDDL can be called
  // multiple times
  if ( StringHelper.isNotEmpty( existingCheck ) && !existingCheck.contains( checkConstraint ) ) {
    checkConstraint = col.getCheckConstraint() + " AND " + checkConstraint;
  }
  col.setCheckConstraint( checkConstraint );
}

代码示例来源: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

copy.setUnique( column.isUnique() );
copy.setSqlType( column.getSqlType() );
copy.setCheckConstraint( column.getCheckConstraint() );
copy.setComment( column.getComment() );
copy.setDefaultValue( column.getDefaultValue() );

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

private static void applyMin(Property property, ConstraintDescriptor<?> descriptor) {
  if ( Min.class.equals( descriptor.getAnnotation().annotationType() ) ) {
    @SuppressWarnings( "unchecked" )
    ConstraintDescriptor<Min> minConstraint = (ConstraintDescriptor<Min>) descriptor;
    long min = minConstraint.getAnnotation().value();
    Column col = (Column) property.getColumnIterator().next();
    col.setCheckConstraint( col.getName() + ">=" + min );
  }
}

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

private static void applyMax(Property property, ConstraintDescriptor<?> descriptor) {
  if ( Max.class.equals( descriptor.getAnnotation().annotationType() ) ) {
    @SuppressWarnings( "unchecked" )
    ConstraintDescriptor<Max> maxConstraint = (ConstraintDescriptor<Max>) descriptor;
    long max = maxConstraint.getAnnotation().value();
    Column col = (Column) property.getColumnIterator().next();
    col.setCheckConstraint( col.getName() + "<=" + max );
  }
}

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

copy.setUnique( column.isUnique() );
copy.setSqlType( column.getSqlType() );
copy.setCheckConstraint( column.getCheckConstraint() );
copy.setComment( column.getComment() );
copy.setDefaultValue( column.getDefaultValue() );

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

column.setCheckConstraint( columnSource.getCheckCondition() );
column.setDefaultValue( columnSource.getDefaultValue() );
column.setSqlType( columnSource.getSqlType() );

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

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

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

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

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

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

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

public void apply(Property property) {
    Column col = (Column) property.getColumnIterator().next();
    col.setCheckConstraint( col.getName() + " < current_date" );
  }
}

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

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

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

private static void applySQLCheck(Column col, String checkConstraint) {
  String existingCheck = col.getCheckConstraint();
  // need to check whether the new check is already part of the existing check, because applyDDL can be called
  // multiple times
  if ( StringHelper.isNotEmpty( existingCheck ) && !existingCheck.contains( checkConstraint ) ) {
    checkConstraint = col.getCheckConstraint() + " AND " + checkConstraint;
  }
  col.setCheckConstraint( checkConstraint );
}

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

copy.setUnique( column.isUnique() );
copy.setSqlType( column.getSqlType() );
copy.setCheckConstraint( column.getCheckConstraint() );
copy.setComment( column.getComment() );
copy.setDefaultValue( column.getDefaultValue() );

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

public void apply(Property property) {
  Column col = (Column) property.getColumnIterator().next();
  String check = "";
  if ( min != Long.MIN_VALUE ) check += col.getName() + ">=" + min;
  if ( max != Long.MAX_VALUE && min != Long.MIN_VALUE ) check += " and ";
  if ( max != Long.MAX_VALUE ) check += col.getName() + "<=" + max;
  col.setCheckConstraint( check );
}

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

private static void applySQLCheck(Column col, String checkConstraint) {
  String existingCheck = col.getCheckConstraint();
  // need to check whether the new check is already part of the existing check, because applyDDL can be called
  // multiple times
  if ( StringHelper.isNotEmpty( existingCheck ) && !existingCheck.contains( checkConstraint ) ) {
    checkConstraint = col.getCheckConstraint() + " AND " + checkConstraint;
  }
  col.setCheckConstraint( checkConstraint );
}

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

public void apply(Property property) {
  Column col = (Column) property.getColumnIterator().next();
  String check = "";
  if ( min != Long.MIN_VALUE ) check += col.getName() + ">=" + min;
  if ( max != Long.MAX_VALUE && min != Long.MIN_VALUE ) check += " and ";
  if ( max != Long.MAX_VALUE ) check += col.getName() + "<=" + max;
  col.setCheckConstraint( check );
}

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

private static void applySQLCheck(Column col, String checkConstraint) {
  final String existingCheck = col.getCheckConstraint();
  // need to check whether the new check is already part of the existing check, because applyDDL can be called
  // multiple times
  if ( StringHelper.isNotEmpty( existingCheck ) && !existingCheck.contains( checkConstraint ) ) {
    checkConstraint = col.getCheckConstraint() + " AND " + checkConstraint;
  }
  col.setCheckConstraint( checkConstraint );
}

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

copy.setUnique( column.isUnique() );
copy.setSqlType( column.getSqlType() );
copy.setCheckConstraint( column.getCheckConstraint() );
copy.setComment( column.getComment() );
copy.setDefaultValue( column.getDefaultValue() );

代码示例来源: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() );

}

相关文章