查询在HQL中返回零记录(查询1 =查询2 +查询3):
两个OR条件.它不返回结果,而是返回零记录
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')));
Run Code Online (Sandbox Code Playgroud)
Query2以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')));
Run Code Online (Sandbox Code Playgroud)
Query3在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'));
Run Code Online (Sandbox Code Playgroud)
当我们结合条件时 - 查询1结果为零记录
我怀疑这是一个hibernate错误或默认行为或查询需要纠正.
在连接多个表时,OR和And条件基本上不能正常工作.
谢谢.
| 归档时间: |
|
| 查看次数: |
274 次 |
| 最近记录: |