Skip to content

Small enhancement for in memory evaluation of polymorphic query #3654

Open
@csharper2010

Description

@csharper2010

Currently, we get the warning...

firstResult/maxResults specified on polymorphic query; applying in memory!

... quite often with queries having set a MaxRows row selection on a base entity class of polymorphic nature.

There are situations where it is absolutely correct to warn in such a case:

  • some results should be skipped with set FirstResult: the skipped records need to be calculated in memory
  • the query has an order by clause: the ordering is not handled correctly

In my case, I have the situation where I want to check if there are entities for a certain criteria or I just want to find some of them as a worklist for now. I don't care about sort order (there is no order by clause in the query).

In this case I would expect

  • to get the query translators are evaluated step by step until I reach the MaxRows limit
  • to not get a warning

In each iteration over the translators, we can calculate the maximum number of to-be-fetched rows as the difference between the total MaxRows and the already fetched rows. Additionally, I would like to change the includedCount variable to be zero-based and not minus-one-based because that's counterintuitive.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions