Custom Function without META-INF service entry?

Hello! I followed this excellent tutorial to migrate a custom function out of a Dialect and into a FunctionContributor:

This step is problematic, as our in-house pattern is to put all such kinds of configs into the application.yml:
The last step will be creating the Hibernate meta hint file in our classpath to instruct we want to register a custom FunctionContributor:

And on that file, add our custom function contributor full class name:

Can the reference to our CustomFunctionsContributor be expressed in the yaml somehow?

Thank you!

As you can find in FunctionContributor’s javadoc, there are programmatic alternatives to register custom implementations other than registering Java service:

  • org.hibernate.cfg.Configuration#registerFunctionContributor
  • org.hibernate.boot.MetadataBuilder#applyFunctions

You should always call one of these methods before constructing the SessionFactory used in the application where you want your custom functions to be available.