HHH-15041 H2Dialect does not work properly with h2 2.0.202 due to new DDL type requirements

This commit is contained in:
Christian Beikov 2022-01-19 12:40:26 +01:00 committed by Sanne Grinovero
parent 0fc59729da
commit cf1853a4a0
1 changed files with 7 additions and 0 deletions

View File

@ -16,6 +16,7 @@ import org.hibernate.boot.TempTableDdlTransactionHandling;
import org.hibernate.cfg.AvailableSettings;
import org.hibernate.dialect.function.AvgWithArgumentCastFunction;
import org.hibernate.dialect.function.NoArgSQLFunction;
import org.hibernate.dialect.function.SQLFunctionTemplate;
import org.hibernate.dialect.function.StandardSQLFunction;
import org.hibernate.dialect.function.VarArgsSQLFunction;
import org.hibernate.dialect.hint.IndexQueryHintHandler;
@ -150,6 +151,12 @@ public class H2Dialect extends Dialect {
registerColumnType( Types.BLOB, "blob" );
registerColumnType( Types.CLOB, "clob" );
if ( isVersion2 ) {
registerColumnType( Types.LONGVARCHAR, "character varying" );
registerColumnType( Types.BINARY, "binary($l)" );
registerFunction( "str", new SQLFunctionTemplate( StandardBasicTypes.STRING, "cast(?1 as character varying)") );
}
// Aggregations ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
registerFunction( "avg", new AvgWithArgumentCastFunction( "double" ) );