it does exist a way to register custom SQL functions at runtime in HIbernate 5.3? It seems that since this changeset[1] was introduced, is not possible.
Correct me if I’m wrong, but the current options to register a custom SQL function in Hibernate are the following ones:
Create a custom dialect and register the functions on the constructor.
Get the Configuration object when the app starts and register the SQL functions.
Use a MetadataBuilderInitializer
But as far as I know none of this options allows to add SQL functions after Hibernate has been set up.
What do you think? What is the recommended approach in this case?
@vlad thanks for the information and great article!
Just to let you know, the solution that we finally took as at the moment we targeted this problem, this feature (registering the functions at runtime) was not available for us, is providing an API for our developers to register the SQL functions just at server startup.
We are using a different approach from the ones mentioned in the article: to use the Configuration class.
We are retrieving the map of SQL functions and internally we are adding those functions with the addSqlFunction method of the Configuration class.