use of com.blazebit.persistence.view.impl.objectbuilder.transformer.correlation.MultisetCorrelationBuilder in project blaze-persistence by Blazebit.
the class CorrelationMultisetTupleElementMapper method applyMapping.
@Override
public void applyMapping(SelectBuilder<?> queryBuilder, ParameterHolder<?> parameterHolder, Map<String, Object> optionalParameters, ViewJpqlMacro viewJpqlMacro, EmbeddingViewJpqlMacro embeddingViewJpqlMacro, boolean asString) {
String oldEmbeddingViewPath = embeddingViewJpqlMacro.getEmbeddingViewPath();
embeddingViewJpqlMacro.setEmbeddingViewPath(embeddingViewPath);
SubqueryInitiator<?> subqueryInitiator = queryBuilder.selectSubquery("subquery", "TO_MULTISET(subquery)");
CorrelationProvider correlationProvider = correlationProviderFactory.create(parameterHolder, optionalParameters);
MultisetCorrelationBuilder correlationBuilder = new MultisetCorrelationBuilder(subqueryInitiator, (ServiceProvider) queryBuilder, correlationAlias);
correlationProvider.applyCorrelation(correlationBuilder, correlationBasis);
SubqueryBuilder<?> subqueryBuilder = correlationBuilder.getSubqueryBuilder();
for (TupleElementMapper mapper : subviewTemplate.getMappers()) {
mapper.applyMapping(subqueryBuilder, parameterHolder, optionalParameters, viewJpqlMacro, embeddingViewJpqlMacro, true);
}
if (indexTemplate != null) {
for (TupleElementMapper mapper : indexTemplate.getMappers()) {
mapper.applyMapping(subqueryBuilder, parameterHolder, optionalParameters, viewJpqlMacro, embeddingViewJpqlMacro, true);
}
} else if (indexExpression != null) {
subqueryBuilder.select(indexExpression);
}
if (limiter != null) {
limiter.apply(parameterHolder, optionalParameters, subqueryBuilder);
}
subqueryBuilder.end();
embeddingViewJpqlMacro.setEmbeddingViewPath(oldEmbeddingViewPath);
}
Aggregations