There is a problem with the parameter binding of dynamic filter parameters in case you use a dynamic filter definition on a OneToMany child collection. The order in which the parameters get bound does not necessarily match the order in which the query defined them.
I am quite new to this so I try to explain as best as I can.
I have a root entity with a filter definition for the deletion timestamp column, and I also apply this filter on its child entities for their deletion timestamp columns:
This is one of the child entites:
Now if I enable the filter in the session:
and execute the following query:
the query will result in the following SQL:
Now watch how the parameters get bound in the wrong order (the dynamic filter is parameter 3 although it should be 1):
I have debugged the code and I found out that although method JoinProcessor#processDynamicFilterParameters() adds the dynamic filter parameters last to the current JOIN, the SQL statement generation happens in the opposite order in method JoinSequence#toJoinFragment() and puts it first:
That is why I would suggest that the easiest bugfix for this is just putting the filter condition in the JoinSequence#toJoinFragment() method to the end as well:
This is a blocker because there is no workaround for that case.