Hibernate 6 QuarkusH2Dialect registerFunction

Hi,
I’m using Quarkus and Hibernate. There is a custom class which extends QuarkusH2Dialect. But after migration to Hibernate 6 it doesn’t work anymore. What is the solution?

import io.quarkus.hibernate.orm.runtime.dialect.QuarkusH2Dialect
import org.hibernate.dialect.function.SQLFunction
import org.hibernate.engine.spi.Mapping
import org.hibernate.engine.spi.SessionFactoryImplementor
import org.hibernate.type.StringType
import org.hibernate.type.Type

class MyDialect : QuarkusH2Dialect() {

    init {
        registerFunction(
            "calculate_hash",
            object : SQLFunction {
                override fun hasArguments() = true
                override fun hasParenthesesIfNoArguments() = false
                override fun getReturnType(firstArgumentType: Type?, mapping: Mapping?) = StringType.INSTANCE
                override fun render(firstArgumentType: Type?, arguments: List<Any?>?, factory: SessionFactoryImplementor?) =
                    "hash('calculate_hash', ${arguments?.first()})"
            }
        )
    }
}

Create a custom FunctionContributor instead like shown in Migration of dialect to Hibernate 6 - #2 by beikov and Migrate Hibernate 5 to 6 with Spring Boot 2.7.x to 3