Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simple query with an EXISTS clause and pagination adds an unnecessary inner ID query #1917

Open
shopera007 opened this issue Jun 25, 2024 · 1 comment

Comments

@shopera007
Copy link

A simple query with an EXISTS clause and pagination adds an unnecessary inner ID query:

final CriteriaBuilder<ProductQuestion> criteriaBuilder = this.criteriaBuilderFactory.create(this.entityManager, ProductQuestion.class);
final CriteriaBuilder<ProductQuestion> criteriaBuilder = criteriaBuilder.from(ProductQuestion.class, PRODUCT_QUESTION_ALIAS);

criteriaBuilder
    .whereExists()
    .from(ProductAnswer.class, PRODUCT_ANSWER_ALIAS)
    .select(joinExpressions(PRODUCT_ANSWER_ALIAS, "id"))
    .where(joinExpressions(PRODUCT_ANSWER_ALIAS, ProductAnswer_.QUESTION, ProductQuestion_.ID))
    .eqExpression(joinExpressions(PRODUCT_QUESTION_ALIAS, ProductQuestion_.ID))
    .end();

Is there any way to force Blaze-Persistence not to use an inner ID query? I'm joining with no collection and just using a simple EXISTS query, which has no impact on pagination.

Could you please help me, thanks

@beikov
Copy link
Member

beikov commented Jul 5, 2024

Can you please post the generated SQL?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants