I use filters to remove soft-deleted entities from query results and collections. I do this using the @Filter annotations on both the table and the joined collection fields for joined tabled. This has been working very well so far, but I have just discovered that it does not work when using the "IS EMPTY" and "IS NOT EMPTY" clauses in queries:
Code:
SELECT DISTINCT p FROM Product p WHERE p.items IS EMPTY
If there is a product that has a single item that has been soft-deleted, I expect it would be removed from the filter and the IS EMPTY would be true. However, that is not the case as the filter condition does not get added to the generated postgres SQL:
Code:
select product0_.product_id as product1_22_, ... from product product0_ where 'F' = product0_.is_deleted_yn and not (exists (select item1_.item_id from item item1_ where product0_.product_id=item1_.product_id))
When it should be:
Code:
select product0_.product_id as product1_22_, ... from product product0_ where 'F' = product0_.is_deleted_yn and not (exists (select item1_.item_id from item item1_ where 'F' = item1_.is_deleted_yn and product0_.product_id=item1_.product_id))
So, is this a bug?
Thanks,
Cameron