本文整理了Java中org.hibernate.mapping.Column.setUnique()
方法的一些代码示例,展示了Column.setUnique()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Column.setUnique()
方法的具体详情如下:
包路径:org.hibernate.mapping.Column
类名称:Column
方法名:setUnique
暂无
代码示例来源:origin: hibernate/hibernate-orm
this.mappingColumn.setUnique( unique );
代码示例来源: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.setNullable( column.isNullable() );
copy.setPrecision( column.getPrecision() );
copy.setUnique( column.isUnique() );
copy.setSqlType( column.getSqlType() );
copy.setCheckConstraint( column.getCheckConstraint() );
代码示例来源:origin: hibernate/hibernate-orm
copy.setNullable( column.isNullable() );
copy.setPrecision( column.getPrecision() );
copy.setUnique( column.isUnique() );
copy.setSqlType( column.getSqlType() );
copy.setCheckConstraint( column.getCheckConstraint() );
代码示例来源:origin: hibernate/hibernate-orm
column.setUnique( columnSource.isUnique() );
代码示例来源: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.orm/hibernate-core
public Column(Identifier columnName, boolean isUnique) {
setName( columnName );
setUnique( isUnique );
}
代码示例来源:origin: org.hibernate/hibernate-annotations
copy.setNullable( column.isNullable() );
copy.setPrecision( column.getPrecision() );
copy.setUnique( column.isUnique() );
copy.setSqlType( column.getSqlType() );
copy.setCheckConstraint( column.getCheckConstraint() );
代码示例来源:origin: org.hibernate/hibernate-annotations
copy.setNullable( column.isNullable() );
copy.setPrecision( column.getPrecision() );
copy.setUnique( column.isUnique() );
copy.setSqlType( column.getSqlType() );
copy.setCheckConstraint( column.getCheckConstraint() );
代码示例来源: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: org.hibernate/com.springsource.org.hibernate
public static void bindColumn(Element node, Column column, boolean isNullable) throws MappingException {
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() );
String customWrite = node.attributeValue( "write" );
if(customWrite != null && !customWrite.matches("[^?]*\\?[^?]*")) {
throw new MappingException("write expression must contain exactly one value placeholder ('?') character");
}
column.setCustomWrite( customWrite );
column.setCustomRead( node.attributeValue( "read" ) );
Element comment = node.element("comment");
if (comment!=null) column.setComment( comment.getTextTrim() );
}
代码示例来源:origin: org.hibernate/com.springsource.org.hibernate.core
public static void bindColumn(Element node, Column column, boolean isNullable) throws MappingException {
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() );
String customWrite = node.attributeValue( "write" );
if(customWrite != null && !customWrite.matches("[^?]*\\?[^?]*")) {
throw new MappingException("write expression must contain exactly one value placeholder ('?') character");
}
column.setCustomWrite( customWrite );
column.setCustomRead( node.attributeValue( "read" ) );
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 bindColumnConfigToColumn(PersistentProperty property, Column column, ColumnConfig columnConfig) {
final PropertyConfig mappedForm = property != null ? (PropertyConfig) property.getMapping().getMappedForm() : null;
boolean allowUnique = mappedForm != null && !mappedForm.isUniqueWithinGroup();
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());
}
if(allowUnique) {
column.setUnique(columnConfig.getUnique());
}
}
代码示例来源:origin: jboss.jboss-embeddable-ejb3/hibernate-all
/**
* Shallow copy, the value is not copied
*/
protected Object 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 );
return copy;
}
代码示例来源: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() );
}
代码示例来源:origin: org.hibernate/com.springsource.org.hibernate.core
/**
* Shallow copy, the value is not copied
*/
protected Object 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: org.hibernate/com.springsource.org.hibernate
/**
* Shallow copy, the value is not copied
*/
protected Object 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: jboss.jboss-embeddable-ejb3/hibernate-all
copy.setNullable( column.isNullable() );
copy.setPrecision( column.getPrecision() );
copy.setUnique( column.isUnique() );
copy.setSqlType( column.getSqlType() );
copy.setCheckConstraint( column.getCheckConstraint() );
内容来源于网络,如有侵权,请联系作者删除!