Filter with a custom condition breaks rows counting

When using filter with a custom condition based on a child entity, like in code below, it breaks rows counting and hence rows browsing (paging). Actually rows counting become sensetive to “show rows” filter parameters.

<filter id="filter"
            <properties include=".*"/>
            <custom caption="Order Items contains"
                    join="join {E}.items i"
                    paramClass="com.haulmont.sampler.entity.Product"> = ?</custom>

I’ve implemented an example, please check this repo. To reproduce:

  1. Generate test data using JMX bean
  2. Import filter using entity inspector from file FilterEntity.json
  3. Try to use filter - there are 3000 recs all, but if set year 2014 it will be either >3000 or below 50, like on this screenshots.


Screenshot from 2017-05-28 10-51-59

Screenshot from 2017-05-28 10-52-17

Screenshot from 2017-05-28 10-52-47

Screenshot from 2017-05-28 10-53-02

Try to add “distinct” to your query. See details here: Queries with distinct - CUBA Platform. Developer’s Manual

This works, thank you a lot.