if ( StringHelper.isNotEmpty( columnSource.getName() ) ) { logicalName = database.toIdentifier( columnSource.getName() ); if ( columnSource.getSizeSource() != null ) { if ( columnSource.getSizeSource().getLength() != null ) { column.setLength( columnSource.getSizeSource().getLength() ); if ( columnSource.getSizeSource().getScale() != null ) { column.setScale( columnSource.getSizeSource().getScale() ); if ( columnSource.getSizeSource().getPrecision() != null ) { column.setPrecision( columnSource.getSizeSource().getPrecision() ); column.setNullable( interpretNullability( columnSource.isNullable(), areColumnsNullableByDefault ) ); column.setUnique( columnSource.isUnique() ); column.setCheckConstraint( columnSource.getCheckCondition() ); column.setDefaultValue( columnSource.getDefaultValue() ); column.setSqlType( columnSource.getSqlType() ); column.setComment( columnSource.getComment() ); column.setCustomRead( columnSource.getReadFragment() ); column.setCustomWrite( columnSource.getWriteFragment() ); for ( String name : columnSource.getIndexConstraintNames() ) { table.getOrCreateIndex( name ).addColumn( column );
public ManyToOneColumnBinder( MappingDocument mappingDocument, SingularAttributeSourceManyToOne manyToOneSource, ManyToOne manyToOneBinding, String referencedEntityName) { this.mappingDocument = mappingDocument; this.manyToOneSource = manyToOneSource; this.manyToOneBinding = manyToOneBinding; this.referencedEntityName = referencedEntityName; boolean allNamed = true; for ( RelationalValueSource relationalValueSource : manyToOneSource.getRelationalValueSources() ) { if ( relationalValueSource instanceof ColumnSource ) { if ( ( (ColumnSource) relationalValueSource ).getName() == null ) { allNamed = false; break; } } } this.allColumnsNamed = allNamed; }
private void resolveLob(final SingularAttributeSourceBasic attributeSource, SimpleValue value) { // Resolves whether the property is LOB based on the type attribute on the attribute property source. // Essentially this expects the type to map to a CLOB/NCLOB/BLOB sql type internally and compares. if ( !value.isLob() && value.getTypeName() != null ) { final TypeResolver typeResolver = attributeSource.getBuildingContext().getMetadataCollector().getTypeResolver(); final BasicType basicType = typeResolver.basic( value.getTypeName() ); if ( basicType instanceof AbstractSingleColumnStandardBasicType ) { if ( isLob( ( (AbstractSingleColumnStandardBasicType) basicType ).getSqlTypeDescriptor().getSqlType(), null ) ) { value.makeLob(); } } } // If the prior check didn't set the lob flag, this will inspect the column sql-type attribute value and // if this maps to CLOB/NCLOB/BLOB then the value will be marked as lob. if ( !value.isLob() ) { for ( RelationalValueSource relationalValueSource : attributeSource.getRelationalValueSources() ) { if ( ColumnSource.class.isInstance( relationalValueSource ) ) { if ( isLob( null, ( (ColumnSource) relationalValueSource ).getSqlType() ) ) { value.makeLob(); } } } } }
public ManyToOneColumnBinder( MappingDocument mappingDocument, SingularAttributeSourceManyToOne manyToOneSource, ManyToOne manyToOneBinding, String referencedEntityName) { this.mappingDocument = mappingDocument; this.manyToOneSource = manyToOneSource; this.manyToOneBinding = manyToOneBinding; this.referencedEntityName = referencedEntityName; boolean allNamed = true; for ( RelationalValueSource relationalValueSource : manyToOneSource.getRelationalValueSources() ) { if ( relationalValueSource instanceof ColumnSource ) { if ( ( (ColumnSource) relationalValueSource ).getName() == null ) { allNamed = false; break; } } } this.allColumnsNamed = allNamed; }
if ( StringHelper.isNotEmpty( columnSource.getName() ) ) { logicalName = database.toIdentifier( columnSource.getName() ); final Column column = new Column( logicalName, columnSource.isUnique() ); if ( columnSource.getSizeSource() != null ) { if ( columnSource.getSizeSource().getLength() != null ) { column.setLength( columnSource.getSizeSource().getLength() ); if ( columnSource.getSizeSource().getScale() != null ) { column.setScale( columnSource.getSizeSource().getScale() ); if ( columnSource.getSizeSource().getPrecision() != null ) { column.setPrecision( columnSource.getSizeSource().getPrecision() ); column.setNullable( interpretNullability( columnSource.isNullable(), areColumnsNullableByDefault ) ); column.setCheckConstraint( columnSource.getCheckCondition() ); column.setDefaultValue( columnSource.getDefaultValue() ); column.setSqlType( columnSource.getSqlType() ); column.setComment( columnSource.getComment() ); column.setCustomRead( columnSource.getReadFragment() ); column.setCustomWrite( columnSource.getWriteFragment() ); for ( String name : columnSource.getIndexConstraintNames() ) { table.getOrCreateIndex( name ).addColumn( column );