| We’ve encountered a case which I believe is really an instance of this bug. We have a set of (~100) Entities (most with soft delete implemented), and a moderately interwoven set of dependancies with them. Whilst everything works fine with direct loading (as all the key relationships between soft deletable Entities are Lazy), if we use CriteriaBuilder and are doing a join between two soft deleted Entities, the @Where annotation is not utilised for the Entity that is the target of the join. I believe (although have not proven) that this is an instance of this problem, as the use of the explicit join through the CriteriaBuilder makes those joins explicitly eager; irrespective of what the ‘default’ specified on the Entity itself is. (This is with Hibernate 5.4.3). In order to work around this, we have to ensure we include the @Where condition in each query; which does somewhat reduce the value of the @Where, particularly when there’s 4-5 such joins in the query. |