Query Returns null entries in HQL (Query 1 = Query 2 + Query 3):
Two conditions OR. Instead of returning results, it returns null records
from Employee as emp where empState = 'ACTIVE' and exists (from EmployeeOrg as EmployeeOrg where 52 = 52 and ((EmployeeOrg.empDetailTable is null and EmployeeOrg.empId like '10002') or (EmployeeOrg.empDetailTable is not null and EmployeeOrg.empDetailTable.empId like '10002')));
Query2 returns records in HQL:
from Employee as emp where empState = 'ACTIVE' and exists (from EmployeeOrg as EmployeeOrg where 52 = 52 and ((EmployeeOrg.empDetailTable is null and EmployeeOrg.empId like '10002')));
Query3 returns Zero Records in HQL
from Employee as emp where empState = 'ACTIVE' and exists (from EmployeeOrg as EmployeeOrg where 52 = 52 and (EmployeeOrg.empDetailTable is not null and EmployeeOrg.empDetailTable.empId like '10002'));
When we combine the condition - Query 1 returns null records
I suspect that this is a bug in sleep mode, or you need to fix the default behavior or request.
Basically, the OR and And conditions do not work properly when joining multiple tables.
Thanks.
hibernate
Kathir
source share