From 0198e5b3c8b5d06d64b7354227c98b5e742d6ec6 Mon Sep 17 00:00:00 2001 From: Andrea Boriero Date: Thu, 6 Oct 2022 09:55:34 +0200 Subject: [PATCH] HHH-15573 SpannerDialect, schema creation generates SQL containing 'null' instead of the column type --- .../dialect/SpannerDialectTableExporter.java | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/hibernate-core/src/main/java/org/hibernate/dialect/SpannerDialectTableExporter.java b/hibernate-core/src/main/java/org/hibernate/dialect/SpannerDialectTableExporter.java index 994ac5755a..6e45c874cc 100644 --- a/hibernate-core/src/main/java/org/hibernate/dialect/SpannerDialectTableExporter.java +++ b/hibernate-core/src/main/java/org/hibernate/dialect/SpannerDialectTableExporter.java @@ -63,10 +63,10 @@ class SpannerDialectTableExporter implements Exporter { keyColumns = Collections.emptyList(); } - return getTableString( table, keyColumns, context ); + return getTableString( table, metadata, keyColumns, context ); } - private String[] getTableString(Table table, Iterable keyColumns, SqlStringGenerationContext context) { + private String[] getTableString(Table table, Metadata metadata, Iterable keyColumns, SqlStringGenerationContext context) { String primaryKeyColNames = StreamSupport.stream( keyColumns.spliterator(), false ) .map( Column::getName ) .collect( Collectors.joining( "," ) ); @@ -75,10 +75,11 @@ class SpannerDialectTableExporter implements Exporter
{ for ( Column column : table.getColumns() ) { - String columnDeclaration = + final String sqlType = column.getSqlType( metadata.getDatabase().getTypeConfiguration(), spannerDialect, metadata ); + final String columnDeclaration = column.getName() - + " " + column.getSqlType() - + ( column.isNullable() ? this.spannerDialect.getNullColumnString( column.getSqlType() ) : " not null" ); + + " " + sqlType + + ( column.isNullable() ? this.spannerDialect.getNullColumnString( sqlType ) : " not null" ); colsAndTypes.add( columnDeclaration ); }