final String explicitName = columnElement.attributeValue( "name" );
final String logicalColumnName = getNamingStrategy().logicalColumnName( explicitName, propertyPath );
final String columnName = getNamingStrategy().columnName( explicitName );
// todo : find out the purpose of these logical bindings
// mappings.addColumnBinding( logicalColumnName, column, table );
Column column = table.createColumn( columnName );
value = column;
basicColumnBinding( columnElement, column, isNullableByDefault );
propertyUniqueKeyBinder.bindColumn( column );
propertyIndexBinder.bindColumn( column );
new UniqueKeyBinder( columnElement.attribute( "unique-key" ), table ).bindColumn( column );
new IndexBinder( columnElement.attribute( "index" ), table ).bindColumn( column );
}
else if ( "formula".equals( valueElement.getName() ) ) {
value = table.createDerivedValue( valueElement.getTextTrim() );
}
}
// todo : logical 1-1 handling
// final Attribute uniqueAttribute = node.attribute( "unique" );
// if ( uniqueAttribute != null
// && "true".equals( uniqueAttribute.getValue() )
// && ManyToOne.class.isInstance( simpleValue ) ) {
// ( (ManyToOne) simpleValue ).markAsLogicalOneToOne();
// }
if ( tuple != null ) {
return tuple;
}
else if ( value != null ) {
return value;
}
else if ( autoColumnCreation ) {
final String columnName = getNamingStrategy().propertyToColumnName( propertyPath );
final String logicalColumnName = getNamingStrategy().logicalColumnName( null, propertyPath );
// todo : find out the purpose of these logical bindings
// mappings.addColumnBinding( logicalColumnName, column, table );
Column column = table.createColumn( columnName );
basicColumnBinding( propertyElement, column, isNullableByDefault );
propertyUniqueKeyBinder.bindColumn( column );
propertyIndexBinder.bindColumn( column );
return column;
}
}
if ( propertyElement.elementIterator( "column" ).hasNext() ) {
throw new MappingException( "column attribute may not be used together with <column> subelement" );
}
if ( propertyElement.elementIterator( "formula" ).hasNext() ) {
throw new MappingException( "column attribute may not be used together with <formula> subelement" );
}
final String explicitName = columnAttribute.getValue();
final String logicalColumnName = getNamingStrategy().logicalColumnName( explicitName, propertyPath );
final String columnName = getNamingStrategy().columnName( explicitName );
// todo : find out the purpose of these logical bindings
// mappings.addColumnBinding( logicalColumnName, column, table );
Column column = table.createColumn( columnName );
basicColumnBinding( propertyElement, column, isNullableByDefault );
propertyUniqueKeyBinder.bindColumn( column );
propertyIndexBinder.bindColumn( column );
return column;
}