HHH-14745 Directly contribute functions to the SqmFunctionRegistry

This commit is contained in:
Karel Maesen 2021-07-26 15:37:59 +02:00 committed by Christian Beikov
parent c0a18ee99e
commit 649b2187e1
3 changed files with 4 additions and 27 deletions

View File

@ -1,24 +0,0 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
*/
package org.hibernate.boot.model;
import org.hibernate.query.sqm.function.SqmFunctionDescriptor;
/**
* Defines the target for contributing functions via {@link FunctionContributor}
*
* @author Karel Maesen
*/
public interface FunctionContributions {
/**
* Add the function under the specified name
* @param registrationKey the name under which to register the function
* @param function the function description
*/
void contributeFunction(String registrationKey, SqmFunctionDescriptor function);
}

View File

@ -14,6 +14,7 @@
package org.hibernate.boot.model;
import org.hibernate.query.sqm.function.SqmFunctionRegistry;
import org.hibernate.service.ServiceRegistry;
/**
@ -26,10 +27,10 @@ public interface FunctionContributor {
/**
* Contribute functions
*
* @param functionContributions The callback for contributing functions
* @param functionRegistry The target for the contributions
* @param serviceRegistry The service registry
*/
void contributeFunctions(FunctionContributions functionContributions, ServiceRegistry serviceRegistry);
void contributeFunctions(SqmFunctionRegistry functionRegistry, ServiceRegistry serviceRegistry);
/**
* Determines order in which the contributions will be applied (lowest ordinal first).

View File

@ -133,7 +133,7 @@ public class QueryEngine {
}
for ( FunctionContributor contributor : sortedFunctionContributors( serviceRegistry ) ) {
contributor.contributeFunctions( sqmFunctionRegistry::register, serviceRegistry );
contributor.contributeFunctions( sqmFunctionRegistry, serviceRegistry );
}
final boolean showSQLFunctions = ConfigurationHelper.getBoolean(