How to overwrite spatial function descriptors

Hi Christian. I overlooked the ordinal method in FunctionContributor and will give it a try.

When I debugged it yesterday, I saw that my FunctionContributor ran first and added my descriptors to an empty map. Afterwards Hibernate added its own descriptors through OracleSDOFunctionDescriptors used in OracleDialectContributor#contributeFunctions, overwriting mine. Reading the javadoc of FunctionContributor#ordinal it seems that the default behaviour should be different:

The range 0-500 is reserved for Hibernate, range 500-1000 for libraries and 1000-Integer.MAX_VALUE for user-defined FunctionContributors.

Contributions from higher precedence contributors (higher numbers) effectively override contributions from lower precedence. E.g. if a contributor with precedence 1000 contributes a function named “max”, that will override Hibernate’s standard function of that name.

Maybe using the MetadataBuilderContributor broke this mechanism, but I replaced it now with the Java Service Loader. See my other question: Register FunctionContributor programmatically

I will take a look into that later. Thank you for the hint, Christian!