Multiple joins in query filter throwing error

Upgrading from 6.7.5 to 6.7.12 caused filters with multiple joining conditions to throw errors when run. I have reproduced the issue in 6.9.3, as well.

It seems very similar to the issue described here. Maybe a reintroduced bug?

Here’s an example filter:

<?xml version="1.0" encoding="UTF-8"?>
<filter>
  <and>
    <c name="VrfniCeVhq" class="com.gpc.colocation.entity.ExtAsset" width="1" type="CUSTOM" locCaption="Assigned Asset" entityAlias="e"><![CDATA[aa = :component$filter.VrfniCeVhq75196]]>
      <param name="component$filter.VrfniCeVhq75196" javaClass="com.gpc.colocation.entity.ExtAsset">NULL</param>
      <join><![CDATA[{E}.assignedAsset aa]]></join>
    </c>
    <c name="CibtvkvtWu" class="com.varasset.xam.entity.WorkOrderType" width="1" type="CUSTOM" locCaption="Type" entityAlias="e"><![CDATA[t = :component$filter.CibtvkvtWu61260]]>
      <param name="component$filter.CibtvkvtWu61260" javaClass="com.varasset.xam.entity.WorkOrderType">NULL</param>
      <join><![CDATA[{E}.workOrderType t]]></join>
    </c>
  </and>
</filter>

(Auto-generated and pulled from the DB, so sorry for the weird names)
And here’s the resulting JPQL:

select e from xam$WorkOrder e 
join e.assignedAsset aa 
where (aa = :component_filter_VrfniCeVhq75196 
      and t = :component_filter_CibtvkvtWu61260)

Notice it does not join e.workOrderType t as expected.

Swapping the order of the conditions and re-running the filter gets me this JPQL:

select e from xam$WorkOrder e
join e.workOrderType t 
where (t = :component_filter_CibtvkvtWu61260 
      and aa = :component_filter_VrfniCeVhq75196)

Now it’s not joining e.assignedAsset aa.

Thank you for reporting the problem.
We’ve created an issue: Error happens when multiple joins in query filter without JOIN statement · Issue #1316 · cuba-platform/cuba · GitHub
It is not the same as Multiple joins in query filter don't work - CUBA.Platform

Join condition in the filter correctly works if you specify JOIN statement e.g.
<join><![CDATA[JOIN {E}.workOrderType t]]></join>