Robert Rittwag (
https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=557058%...
) *commented* on HHH-15743 (
https://hibernate.atlassian.net/browse/HHH-15743?atlOrigin=eyJpIjoiODVkYm...
)
Re: Querying with empty parameter list fails (
https://hibernate.atlassian.net/browse/HHH-15743?atlOrigin=eyJpIjoiODVkYm...
)
I see 2 problems here:
* The coalesce(:departments) works fine, with departments either being null or containing
1 or even 500 elements. With this issue I just want it to behave consistently for an empty
list.
* Removing the coalesce part while using the empty list param leads to the SQL
select u1_0.id,u1_0.id_department,u1_0. name from userr u1_0
where 1=0
and 0 results. That’s not what I intended. I understand that a predicate u.department in
() is mathematically false at any time ( 1=0 ). That's why I’m bypassing it's
evaluation when the list is empty.
A workaround/solution may be to keep the coalesce and pass null instead of an empty list.
But in Java it's a good practice to use empty lists instead of null 🙂 .
(
https://hibernate.atlassian.net/browse/HHH-15743#add-comment?atlOrigin=ey...
) Add Comment (
https://hibernate.atlassian.net/browse/HHH-15743#add-comment?atlOrigin=ey...
)
Get Jira notifications on your phone! Download the Jira Cloud app for Android (
https://play.google.com/store/apps/details?id=com.atlassian.android.jira....
) or iOS (
https://itunes.apple.com/app/apple-store/id1006972087?pt=696495&ct=Em...
) This message was sent by Atlassian Jira (v1001.0.0-SNAPSHOT#100210- sha1:eab5823 )