Search in sources :

Example 1 with FunctionPassthroughJpqlMacro

use of com.blazebit.persistence.view.impl.macro.FunctionPassthroughJpqlMacro in project blaze-persistence by Blazebit.

the class MetamodelBuildingContextImpl method createTypeValidationExpressionFactory.

private MacroConfigurationExpressionFactory createTypeValidationExpressionFactory() {
    MacroConfiguration originalMacroConfiguration = expressionFactory.getDefaultMacroConfiguration();
    ExpressionFactory cachingExpressionFactory = expressionFactory.unwrap(AbstractCachingExpressionFactory.class);
    Map<String, MacroFunction> macros = new HashMap<>();
    macros.put("view", new JpqlMacroAdapter(new FunctionPassthroughJpqlMacro("VIEW"), cachingExpressionFactory));
    macros.put("view_root", new JpqlMacroAdapter(new FunctionPassthroughJpqlMacro("VIEW_ROOT"), cachingExpressionFactory));
    macros.put("embedding_view", new JpqlMacroAdapter(new FunctionPassthroughJpqlMacro("EMBEDDING_VIEW"), cachingExpressionFactory));
    MacroConfiguration macroConfiguration = originalMacroConfiguration.with(macros);
    return new MacroConfigurationExpressionFactory(cachingExpressionFactory, macroConfiguration);
}
Also used : MacroFunction(com.blazebit.persistence.parser.expression.MacroFunction) MacroConfiguration(com.blazebit.persistence.parser.expression.MacroConfiguration) AbstractCachingExpressionFactory(com.blazebit.persistence.parser.expression.AbstractCachingExpressionFactory) ExpressionFactory(com.blazebit.persistence.parser.expression.ExpressionFactory) MacroConfigurationExpressionFactory(com.blazebit.persistence.view.impl.MacroConfigurationExpressionFactory) FunctionPassthroughJpqlMacro(com.blazebit.persistence.view.impl.macro.FunctionPassthroughJpqlMacro) HashMap(java.util.HashMap) LinkedHashMap(java.util.LinkedHashMap) JpqlMacroAdapter(com.blazebit.persistence.view.impl.JpqlMacroAdapter) MacroConfigurationExpressionFactory(com.blazebit.persistence.view.impl.MacroConfigurationExpressionFactory)

Aggregations

AbstractCachingExpressionFactory (com.blazebit.persistence.parser.expression.AbstractCachingExpressionFactory)1 ExpressionFactory (com.blazebit.persistence.parser.expression.ExpressionFactory)1 MacroConfiguration (com.blazebit.persistence.parser.expression.MacroConfiguration)1 MacroFunction (com.blazebit.persistence.parser.expression.MacroFunction)1 JpqlMacroAdapter (com.blazebit.persistence.view.impl.JpqlMacroAdapter)1 MacroConfigurationExpressionFactory (com.blazebit.persistence.view.impl.MacroConfigurationExpressionFactory)1 FunctionPassthroughJpqlMacro (com.blazebit.persistence.view.impl.macro.FunctionPassthroughJpqlMacro)1 HashMap (java.util.HashMap)1 LinkedHashMap (java.util.LinkedHashMap)1