Hi,
the following query is not working as I expected it to:
Code:
select distinct image
from Image as image
left outer join image.properties as property
where lower(image.displayname) like lower('%[filter]%')
or lower(property.value.value) like lower('%[filter]%')
I expect it to return all entities of Image that either have a displayname that returns true on
Code:
lower(image.displayname) like lower('%[filter]%')
even if there are no properties assigned to it, or have Property entities assigned with a value that returns true on
Code:
lower(property.value.value) like lower('%[filter]%')
Everything works fine except I do not get any Image entities with no Property entities assigned, even if the displayname returns true on
Code:
lower(image.displayname) like lower('%[filter]%')
As an example. There are the following entities:
Code:
abstract class Resource {
List<Property> properties;
String displayname;
}
class Image extends Resource {
}
class Property {
Value value;
}
class Value {
String value;
}
And I have the following data:
Code:
valueA (value = "hello")
propA (value = valueA)
valueB (value = "testValue")
propB (value = valueB)
imageA (displayname = "hello", properties = null)
imageB (displayname = "test", properties = {propA})
imageC (displayname = "hello", properties = {propB})
then the query with [filter] substituted by 'hello' would only return imageB and imageC, even though imageA meets the required
Code:
lower(image.displayname) like lower('%[filter]%')
hopefully someone understood my problem and is able to give me a hint on how to solve this.
Thank you in advance.