title: JPQL LEFT OUTER JOIN WITH CONDITION
body: <p>I have query in jpa like this(didnt work):</p>
  
  <pre><code>entityManager.createQuery("select new pl.proama.wd.model.PolicyDTO2(pol.policyID) from Policy pol LEFT JOIN pol.claim c  WHERE c.claimID=:id").setParameter("id", "20700003915").getResultList();
  </code></pre>
  
  <p>and database table like this:</p>
  
  <p><strong>Policy table -->(Policy_id(pk), other colums)</strong></p>
  
  <p><strong>Claim table --> (Claim_id(pk),Policy_id,other colums)</strong></p>
  
  <p><strong>One policy can join to many claim</strong></p>
  
  <p>Normal plsql query(work):</p>
  
  <pre><code>Select pol.POLICY_ID 
  from Policy pol LEFT JOIN CLAIM c 
  on(c.POLICY_ID=pol.POLICY_ID) 
  WHERE c.CLAIM_ID='20700003915';
  </code></pre>
  
  <p>I think I make mistake in class Policy where I join Claim class.</p>
  
  <pre><code>@OneToOne
  @JoinColumn(name = "POLICY_ID")
  private Claim claim;
  </code></pre>
  
  <p>What I'm doing wrong?</p>