HHH-6365 : Use Identifier.toIdentifier() to create column names
This commit is contained in:
parent
8a5415d367
commit
4febfe4d82
|
@ -32,7 +32,7 @@ import org.hibernate.metamodel.relational.state.ColumnRelationalState;
|
||||||
* @author Steve Ebersole
|
* @author Steve Ebersole
|
||||||
*/
|
*/
|
||||||
public class Column extends AbstractSimpleValue implements SimpleValue {
|
public class Column extends AbstractSimpleValue implements SimpleValue {
|
||||||
private final String name;
|
private final Identifier name;
|
||||||
private boolean nullable;
|
private boolean nullable;
|
||||||
private boolean unique;
|
private boolean unique;
|
||||||
|
|
||||||
|
@ -48,6 +48,10 @@ public class Column extends AbstractSimpleValue implements SimpleValue {
|
||||||
private Size size = new Size();
|
private Size size = new Size();
|
||||||
|
|
||||||
protected Column(TableSpecification table, int position, String name) {
|
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 );
|
super( table, position );
|
||||||
this.name = name;
|
this.name = name;
|
||||||
}
|
}
|
||||||
|
@ -72,7 +76,7 @@ public class Column extends AbstractSimpleValue implements SimpleValue {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getName() {
|
public Identifier getName() {
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -67,7 +67,7 @@ public class TableManipulationTests extends BaseUnitTestCase {
|
||||||
for ( Value value : table.values() ) {
|
for ( Value value : table.values() ) {
|
||||||
assertTrue( Column.class.isInstance( value ) );
|
assertTrue( Column.class.isInstance( value ) );
|
||||||
Column column = ( Column ) value;
|
Column column = ( Column ) value;
|
||||||
if ( column.getName().equals( "id" ) ) {
|
if ( column.getName().equals( Identifier.toIdentifier( "id" ) ) ) {
|
||||||
assertEquals( INTEGER, column.getDatatype() );
|
assertEquals( INTEGER, column.getDatatype() );
|
||||||
assertEquals( 18, column.getSize().getPrecision() );
|
assertEquals( 18, column.getSize().getPrecision() );
|
||||||
assertEquals( 0, column.getSize().getScale() );
|
assertEquals( 0, column.getSize().getScale() );
|
||||||
|
@ -75,7 +75,7 @@ public class TableManipulationTests extends BaseUnitTestCase {
|
||||||
assertNull( column.getSize().getLobMultiplier() );
|
assertNull( column.getSize().getLobMultiplier() );
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
assertEquals( "col_1", column.getName() );
|
assertEquals( Identifier.toIdentifier( "col_1" ), column.getName() );
|
||||||
assertEquals( VARCHAR, column.getDatatype() );
|
assertEquals( VARCHAR, column.getDatatype() );
|
||||||
assertEquals( -1, column.getSize().getPrecision() );
|
assertEquals( -1, column.getSize().getPrecision() );
|
||||||
assertEquals( -1, column.getSize().getScale() );
|
assertEquals( -1, column.getSize().getScale() );
|
||||||
|
|
Loading…
Reference in New Issue