pogacsa
September 14, 2023, 6:28am
1
Hi,
trying to migrate a dialect for exasol and at this stage found NoArgSQLFunction and VarArgsSQLFunction is no longer member of dialect.function.*. By checking SQLFunction source code, it is constructing itself with min(1) as argument numbers.
What is the practical way to migrate old NoArgSQLFunction and the concatenated VarArgsSQLFunction in hibernate 6.
many thanks for an advice
pogacsa
September 14, 2023, 11:24am
2
found workaround for old v5, VarArg:
functionContributions.getFunctionRegistry().register( "concat", new VarArgsSQLFunction(StandardBasicTypes.STRING, "", "||", "") );
to v6:
CommonFunctionFactory functionFactory = new CommonFunctionFactory(functionContributions);
functionFactory.concat_pipeOperator();
and NoArg is now CurrentFunction. Old:
functionContributions.getFunctionRegistry().register( "hash_tiger", new NoArgSQLFunction("hash_tiger", StandardBasicTypes.STRING, false) );
functionContributions.getFunctionRegistry().register( "row_number", new NoArgSQLFunction("row_number", StandardBasicTypes.LONG, false) );
new v6:
final TypeConfiguration typeConfiguration = functionContributions.getTypeConfiguration();
final BasicTypeRegistry basicTypeRegistry = typeConfiguration.getBasicTypeRegistry();
final BasicType<String> stringType = basicTypeRegistry.resolve( StandardBasicTypes.STRING );
final BasicType<Long> longType = basicTypeRegistry.resolve( StandardBasicTypes.LONG );
functionContributions.getFunctionRegistry().register( "hash_tiger", new CurrentFunction("hash_tiger","hash_tiger", stringType) );
functionContributions.getFunctionRegistry().register( "row_number", new CurrentFunction("row_number","row_number", longType) );
I hope it helps for others.