Hierarchical entity lost top item with filter

I use cuba 6.8.8.

I create a category entity, The parent_id of top category is null.

My custom condition filter with under param
where = ({E}.id = ? and {E}.parent is null) or {E}.parent.id = ? or {E}.parent.parent.id = ?
param where = {E}.parent is null

When I use this filter and select a top category, the selected top category was lost from my table or TreeTable.

I checked the eclipselink.sql and saw the select sql had bound the id of top category.

So what’s wrong with me?

Could you provide the JPQL and SQL statements from the log?