HHH-6365 : Use Identifier.toIdentifier() to create column names
This commit is contained in:
parent
6499491374
commit
88f69a135b
|
@ -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 Identifier name;
|
private final Identifier columnName;
|
||||||
private boolean nullable;
|
private boolean nullable;
|
||||||
private boolean unique;
|
private boolean unique;
|
||||||
|
|
||||||
|
@ -53,7 +53,7 @@ public class Column extends AbstractSimpleValue implements SimpleValue {
|
||||||
|
|
||||||
protected Column(TableSpecification table, int position, Identifier name) {
|
protected Column(TableSpecification table, int position, Identifier name) {
|
||||||
super( table, position );
|
super( table, position );
|
||||||
this.name = name;
|
this.columnName = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void initialize(ColumnRelationalState state, boolean forceNonNullable, boolean forceUnique) {
|
public void initialize(ColumnRelationalState state, boolean forceNonNullable, boolean forceUnique) {
|
||||||
|
@ -76,8 +76,8 @@ public class Column extends AbstractSimpleValue implements SimpleValue {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public Identifier getName() {
|
public Identifier getColumnName() {
|
||||||
return name;
|
return columnName;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isNullable() {
|
public boolean isNullable() {
|
||||||
|
@ -154,6 +154,6 @@ public class Column extends AbstractSimpleValue implements SimpleValue {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toLoggableString() {
|
public String toLoggableString() {
|
||||||
return getTable().getLoggableValueQualifier() + '.' + getName();
|
return getTable().getLoggableValueQualifier() + '.' + getColumnName();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -109,7 +109,7 @@ public class TableBinder {
|
||||||
private static Column findColumn(Table table, String columnName) {
|
private static Column findColumn(Table table, String columnName) {
|
||||||
Column column = null;
|
Column column = null;
|
||||||
for ( SimpleValue value : table.values() ) {
|
for ( SimpleValue value : table.values() ) {
|
||||||
if ( value instanceof Column && ( (Column) value ).getName().equals( columnName ) ) {
|
if ( value instanceof Column && ( (Column) value ).getColumnName().getName().equals( columnName ) ) {
|
||||||
column = (Column) value;
|
column = (Column) value;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -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( Identifier.toIdentifier( "id" ) ) ) {
|
if ( column.getColumnName().getName().equals( "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( Identifier.toIdentifier( "col_1" ), column.getName() );
|
assertEquals( "col_1", column.getColumnName().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