HQL "JOIN on" not applying @Where annotation


#1

Hi,

I see that while the HQL converted to sql; If Entities annotated with @Where located in join clauses, they do not have effect on the created query. That said, soft deleted entities returned from the created query and while calling the constructor for CustomDto below; each entity querried again and this time (since entity on the from clause) the @Where annotation applied. And soft deleted entity not returned; voilaaa no entity found exception :slight_smile:

"SELECT new com.foo.CustomDto(B, S, I, U) from Bar B " +
        " left join fetch InBar I on I.type = B.type" +
        " left join fetch UnBar U on U.type = B.type " +
        " left join fetch CunBar S B.spec = S.spec " +
        " where B.id IN :idList "
  1. Above query does not apply @Where clause of InBar entity.
  2. If InBar entity moved to from clause (from InBar…) this time the @Where clause applied.

Is there a specific reason for this behaviour?