use of com.blazebit.persistence.FullQueryBuilder in project blaze-persistence by Blazebit.
the class ViewTypeObjectBuilder method applySelects.
@Override
public <X extends SelectBuilder<X>> void applySelects(X queryBuilder) {
if (fetches.isEmpty()) {
if (secondaryMappers.length != 0) {
FullQueryBuilder<?, ?> fullQueryBuilder = (FullQueryBuilder<?, ?>) queryBuilder;
for (SecondaryMapper viewRoot : secondaryMappers) {
viewRoot.apply(fullQueryBuilder, parameterHolder, optionalParameters, viewJpqlMacro, embeddingViewJpqlMacro);
}
}
for (int i = 0; i < mappers.length; i++) {
mappers[i].applyMapping(queryBuilder, parameterHolder, optionalParameters, viewJpqlMacro, embeddingViewJpqlMacro, false);
}
} else {
if (secondaryMappers.length != 0) {
FullQueryBuilder<?, ?> fullQueryBuilder = (FullQueryBuilder<?, ?>) queryBuilder;
for (SecondaryMapper viewRoot : secondaryMappers) {
if (fetches.contains(viewRoot.getAttributePath())) {
viewRoot.apply(fullQueryBuilder, parameterHolder, optionalParameters, viewJpqlMacro, embeddingViewJpqlMacro);
}
}
}
for (int i = 0; i < mappers.length; i++) {
TupleElementMapper mapper = mappers[i];
String attributePath = mapper.getAttributePath();
if (attributePath != null && fetches.contains(attributePath)) {
mapper.applyMapping(queryBuilder, parameterHolder, optionalParameters, viewJpqlMacro, embeddingViewJpqlMacro, false);
} else {
queryBuilder.select("NULL");
}
}
}
}
Aggregations