I have a Master entity with a one-to-many composition relationship to Detail. I have a datasource
masterDs and CollectionDatasource detailsDs. I can’t have detailsDs as a simple nested datasource under masterDs because I only want a subset of the details. So I have the JPQL query
SELECT e FROM sampleProject$Details e
WHERE
( e.master.id = :ds$masterDs )
and
(e.someOtherBoolean = true)
and
(
(e.someBoolean = true)
or
(---some other expression A that works---)
or
(---some other expression B that works---)
)
Expressions A and B work just fine. e.someOtherBoolean works just fine (insofar as I can check with expessions A and B). I am adding in the first condition e.someBoolean = true and after 5 hours of fighting it today I am no closer to getting the query to return what it needs to. I thought that perhaps someBoolean was not being instantiated. I went into my code and very explicitly instantiated it. Nothing. After googling around I found the coalesce function. I tried to modify my query as
SELECT e FROM sampleProject$Details e
WHERE
( e.master.id = :ds$masterDs )
and
(e.someOtherBoolean = true)
and
(
(coalesce(e.someBoolean, false) = true)
or
(---some other expression A that works---)
or
(---some other expression B that works---)
)
so that the program assumes that someBoolean is false if null. But that didn’t work either. Again, everything besides e.someBoolean works just fine; I was already using this query and I wanted to add to the subset the e.someBoolean = true case. What am I missing here? I am no SQL master so it probably is just some small SQL quirk that I don’t know to check for but any help would be appreciated.