Hibernate INNER connection does not work. SQL Query Works ... Strange Behavior

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.

+8
hibernate
source share

No one has answered this question yet.

See related questions:

3
Hibernate: LEFT JOIN FETCH with multiple columns to join
one
Hibernation selection error on internal join
one
sleeping question about inner connection
one
Hibernate inner join fetch returns nothing if association collection does not exist
one
Hibernate generates cross join instead of left join
one
Hibernate force = 'true' syntax does not work with update request
0
How to perform a connection request in sleep mode?
0
Order by making an internal join automatically
0
Named Sleep Request
0
Hibernate query cache not updating with last database record

All Articles