this.mappingColumn.setUnique( unique );
/** * 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; }
copy.setNullable( column.isNullable() ); copy.setPrecision( column.getPrecision() ); copy.setUnique( column.isUnique() ); copy.setSqlType( column.getSqlType() ); copy.setCheckConstraint( column.getCheckConstraint() );
copy.setNullable( column.isNullable() ); copy.setPrecision( column.getPrecision() ); copy.setUnique( column.isUnique() ); copy.setSqlType( column.getSqlType() ); copy.setCheckConstraint( column.getCheckConstraint() );
column.setUnique( columnSource.isUnique() );
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 ); } }
public Column(Identifier columnName, boolean isUnique) { setName( columnName ); setUnique( isUnique ); }
copy.setNullable( column.isNullable() ); copy.setPrecision( column.getPrecision() ); copy.setUnique( column.isUnique() ); copy.setSqlType( column.getSqlType() ); copy.setCheckConstraint( column.getCheckConstraint() );
copy.setNullable( column.isNullable() ); copy.setPrecision( column.getPrecision() ); copy.setUnique( column.isUnique() ); copy.setSqlType( column.getSqlType() ); copy.setCheckConstraint( column.getCheckConstraint() );
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() ); }
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() ); }
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() ); }
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 ); }
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()); }
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()); } }
/** * 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; }
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() ); }
/** * 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; }
/** * 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; }
copy.setNullable( column.isNullable() ); copy.setPrecision( column.getPrecision() ); copy.setUnique( column.isUnique() ); copy.setSqlType( column.getSqlType() ); copy.setCheckConstraint( column.getCheckConstraint() );