use of com.blazebit.persistence.view.impl.JpqlMacroAdapter 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);
}
use of com.blazebit.persistence.view.impl.JpqlMacroAdapter in project blaze-persistence by Blazebit.
the class MetamodelBuildingContextImpl method createMacroAwareExpressionFactory.
@Override
public MacroConfigurationExpressionFactory createMacroAwareExpressionFactory(String viewRoot) {
MacroConfiguration originalMacroConfiguration = expressionFactory.getDefaultMacroConfiguration();
ExpressionFactory cachingExpressionFactory = expressionFactory.unwrap(AbstractCachingExpressionFactory.class);
Map<String, MacroFunction> macros = new HashMap<>();
macros.put("view", new JpqlMacroAdapter(new MutableViewJpqlMacro(viewRoot), cachingExpressionFactory));
macros.put("view_root", new JpqlMacroAdapter(new DefaultViewRootJpqlMacro(viewRoot), cachingExpressionFactory));
macros.put("embedding_view", new JpqlMacroAdapter(new MutableEmbeddingViewJpqlMacro(), cachingExpressionFactory));
MacroConfiguration macroConfiguration = originalMacroConfiguration.with(macros);
return new MacroConfigurationExpressionFactory(cachingExpressionFactory, macroConfiguration);
}
Aggregations