use of org.hibernate.query.sqm.function.SqmFunctionRegistry in project hibernate-orm by hibernate.
the class MariaDBDialectContributor method contributeFunctions.
@Override
public void contributeFunctions(FunctionContributions functionContributions) {
HSMessageLogger.LOGGER.functionContributions(this.getClass().getCanonicalName());
final KeyedSqmFunctionDescriptors mariaDbFunctions = new MariaDBSqmFunctionDescriptors(functionContributions);
final SqmFunctionRegistry functionRegistry = functionContributions.getFunctionRegistry();
mariaDbFunctions.asMap().forEach((key, desc) -> {
functionRegistry.register(key.getName(), desc);
key.getAltName().ifPresent(altName -> functionRegistry.registerAlternateKey(altName, key.getName()));
});
}
use of org.hibernate.query.sqm.function.SqmFunctionRegistry in project hibernate-orm by hibernate.
the class RequiresFunctionExtension method evaluateExecutionCondition.
@Override
public ConditionEvaluationResult evaluateExecutionCondition(ExtensionContext context) {
Optional<Object> testInstance = context.getTestInstance();
if (!testInstance.isPresent()) {
return ENABLED;
}
ExtensionContext.Store store = JUnitHelper.locateExtensionStore(SessionFactoryExtension.class, context, testInstance.get());
final SessionFactoryScope existing = (SessionFactoryScope) store.get(SessionFactoryScope.class.getName());
if (existing == null) {
return ConditionEvaluationResult.enabled("");
}
final Optional<RequiresFunction> requiresFunctions = TestingUtil.findEffectiveAnnotation(context, RequiresFunction.class);
if (requiresFunctions.isPresent()) {
String functionKey = requiresFunctions.get().key();
SqmFunctionRegistry functionRegistry = existing.getSessionFactory().getQueryEngine().getSqmFunctionRegistry();
if (functionRegistry.findFunctionDescriptor(functionKey) == null) {
return ConditionEvaluationResult.disabled(String.format(Locale.ROOT, "Failed: Required function %s is not available", functionKey));
}
return ConditionEvaluationResult.enabled("Required function is supported");
}
return ENABLED;
}
use of org.hibernate.query.sqm.function.SqmFunctionRegistry in project hibernate-orm by hibernate.
the class MySQLDialectContributor method contributeFunctions.
@Override
public void contributeFunctions(FunctionContributions functionContributions) {
HSMessageLogger.LOGGER.functionContributions(this.getClass().getCanonicalName());
final KeyedSqmFunctionDescriptors mysqlFunctions = new MySqlSqmFunctionDescriptors(functionContributions);
final SqmFunctionRegistry functionRegistry = functionContributions.getFunctionRegistry();
mysqlFunctions.asMap().forEach((key, desc) -> {
functionRegistry.register(key.getName(), desc);
key.getAltName().ifPresent(altName -> functionRegistry.registerAlternateKey(altName, key.getName()));
});
}
use of org.hibernate.query.sqm.function.SqmFunctionRegistry in project hibernate-orm by hibernate.
the class OracleDialectContributor method contributeFunctions.
@Override
public void contributeFunctions(FunctionContributions functionContributions) {
HSMessageLogger.LOGGER.functionContributions(this.getClass().getCanonicalName());
KeyedSqmFunctionDescriptors functionDescriptors;
if (useSTGeometry) {
functionDescriptors = new OracleSQLMMFunctionDescriptors(functionContributions);
} else {
functionDescriptors = new OracleSDOFunctionDescriptors(functionContributions);
}
SqmFunctionRegistry functionRegistry = functionContributions.getFunctionRegistry();
functionDescriptors.asMap().forEach((key, funcDescr) -> {
functionRegistry.register(key.getName(), funcDescr);
key.getAltName().ifPresent(altName -> functionRegistry.register(altName, funcDescr));
});
}
use of org.hibernate.query.sqm.function.SqmFunctionRegistry in project hibernate-orm by hibernate.
the class PostgisDialectContributor method contributeFunctions.
@Override
public void contributeFunctions(FunctionContributions functionContributions) {
HSMessageLogger.LOGGER.functionContributions(this.getClass().getCanonicalName());
final PostgisSqmFunctionDescriptors postgisFunctions = new PostgisSqmFunctionDescriptors(functionContributions);
final SqmFunctionRegistry functionRegistry = functionContributions.getFunctionRegistry();
postgisFunctions.asMap().forEach((key, desc) -> {
functionRegistry.register(key.getName(), desc);
key.getAltName().ifPresent(altName -> functionRegistry.registerAlternateKey(altName, key.getName()));
});
}
Aggregations