|
Problem is in nullable properties that are part of the identifier of a FK.
In this case the query is
from Warehouse as e left join e.locationAddress as join_0 where ( upper((COALESCE(to_char(join_0.addressLine1),'') || ' - ' || COALESCE(to_char(join_0.addressLine2),'') || ' - ' || COALESCE(to_char(join_0.postalCode),'') || ' - ' || COALESCE(to_char(join_0.cityName),'') || ' - ' || (COALESCE(to_char(join_0.region.name),'')) || ' - ' || (COALESCE(to_char((select name from CountryTrl as t where t.country = join_0.country and t.language.language='en_US')), to_char(join_0.country.name), '')))) like upper(:alias_0) escape '|' ) order by e.name,e.id
this part: join_0.region.name creates an inner join with region table which results in no row in case of empty region
Left join should be used instead:
from Warehouse as e
left join e.locationAddress as join_0 left join join_0.region r
where ( upper((COALESCE(to_char(join_0.addressLine1),'') || ' - ' || COALESCE(to_char(join_0.addressLine2),'') || ' - ' || COALESCE(to_char(join_0.postalCode),'') || ' - ' || COALESCE(to_char(join_0.cityName),'') || ' - ' || (COALESCE(to_char(r.name),'')) || ' - ' || (COALESCE(to_char((select name from CountryTrl as t where t.country = join_0.country and t.language.language='en_US')), to_char(join_0.country.name), '')))) like upper('%pam%') escape '|' ) order by e.name,e.id |
|