Hi! I got this problem:
This statement returns me (just as I want) 1:
Code:
SELECT Count(distinct obj.id) from class1 obj LEFT OUTER JOIN obj.someCollection str WHERE Per_ID = 15237 OR 0=1
However, the Thing I really would like to know is this:
Code:
SELECT Count(distinct obj.id) from class1 obj LEFT OUTER JOIN obj.someCollection str WHERE Per_ID = 15237 OR str.relation1.relation2.id = 123
But this one gives me a count of zero when the joined collection is empty. If I look at the resulting SQL-statement I can see that the problem is that this "str.relation1.relation2" is translated into a cross join and the connection is done through an added AND-block in the WHERE-clause
How can I achieve the desired result?