HHH-6365 : Use Identifier.toIdentifier() to create column names

This commit is contained in:
Gail Badner 2011-07-01 13:45:05 -07:00
parent 8a5415d367
commit 4febfe4d82
2 changed files with 8 additions and 4 deletions

View File

@ -32,7 +32,7 @@ import org.hibernate.metamodel.relational.state.ColumnRelationalState;
* @author Steve Ebersole
*/
public class Column extends AbstractSimpleValue implements SimpleValue {
private final String name;
private final Identifier name;
private boolean nullable;
private boolean unique;
@ -48,6 +48,10 @@ public class Column extends AbstractSimpleValue implements SimpleValue {
private Size size = new Size();
protected Column(TableSpecification table, int position, String name) {
this( table, position, Identifier.toIdentifier( name ) );
}
protected Column(TableSpecification table, int position, Identifier name) {
super( table, position );
this.name = name;
}
@ -72,7 +76,7 @@ public class Column extends AbstractSimpleValue implements SimpleValue {
}
}
public String getName() {
public Identifier getName() {
return name;
}

View File

@ -67,7 +67,7 @@ public class TableManipulationTests extends BaseUnitTestCase {
for ( Value value : table.values() ) {
assertTrue( Column.class.isInstance( value ) );
Column column = ( Column ) value;
if ( column.getName().equals( "id" ) ) {
if ( column.getName().equals( Identifier.toIdentifier( "id" ) ) ) {
assertEquals( INTEGER, column.getDatatype() );
assertEquals( 18, column.getSize().getPrecision() );
assertEquals( 0, column.getSize().getScale() );
@ -75,7 +75,7 @@ public class TableManipulationTests extends BaseUnitTestCase {
assertNull( column.getSize().getLobMultiplier() );
}
else {
assertEquals( "col_1", column.getName() );
assertEquals( Identifier.toIdentifier( "col_1" ), column.getName() );
assertEquals( VARCHAR, column.getDatatype() );
assertEquals( -1, column.getSize().getPrecision() );
assertEquals( -1, column.getSize().getScale() );