title: Hibernate INNER join doesn't work..SQL Query Works...Weird Behavior
body: <p>Query Returns zero records in HQL (Query 1 = Query 2 + Query 3):</p>
  
  <p>Two OR conditions..Instead of returning results, it returns zero records</p>
  
  <pre><code>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')));
  </code></pre>
  
  <p>Query2 Returns Records in HQL:</p>
  
  <pre><code>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')));
  </code></pre>
  
  <p>Query3 Returns Zero Records in HQL</p>
  
  <pre><code>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'));
  </code></pre>
  
  <p>When we combine the condition - Query 1 results zero records</p>
  
  <p>I suspect it is a hibernate bug or a default behaviour or query needs to be corrected.</p>
  
  <p>Basically the OR and And condition doesn't work properly during joining multiple tables.</p>
  
  <p>Thanks.</p>