title: Hibernate criteria - Inner Join OR Condition
body: <p>I want to ignore default Join Restriction in <strong>createAlias</strong>. I have a OnetoOne relationship.</p>
  
  <p>My Problem is Hibernate generates default restriction for the join relationship.</p>
  
  <p><strong>Pojo</strong></p>
  
  <p>Note : No column for diagnosticTemplate in charge table.</p>
  
  <p>Charge.java</p>
  
  <pre><code> @OneToOne(mappedBy = "charge")
   private DiagnosticTemplate diagnosticTemplate;
  </code></pre>
  
  <p>DiagnosticTemplate.java</p>
  
  <pre><code>@OneToOne
  @JoinColumn(name = "charge")
  @Exclude
  private Charge charge;
  </code></pre>
  
  <p><strong>Query</strong></p>
  
  <pre><code>select 
    * 
  from 
    charges c 
  inner join diagnostic_template dt 
    on (dt.charge = c.id and dt.status=1) or (dt.status=0)
  </code></pre>
  
  <p><strong>Criteria</strong></p>
  
  <pre><code>Criteria criteria = getSession().createCriteria(Charge.class, "charge")
        .createAlias("charge.diagnosticTemplate", "diagnosticTemplate",
          JoinType.INNER_JOIN,
          Restrictions.or(
             Restriction.and(Restrictions.eqProperty("charge.id", 
                           "diagnosticTemplate.charge"), 
             Restrictions.eq("diagnosticTemplate.status",true)),
             Restrictions.eq("diagnosticTemplate.status",false)  ))
  </code></pre>
  
  <p><strong>Hibernate Query</strong></p>
  
  <pre><code>select 
    * 
  from 
    charges c 
  inner join diagnostic_template dt 
    on dt.charge = c.id and (dt.charge = c.id and dt.status=1) or (dt.status=0)
  </code></pre>
  
  <p>How to avoid this condition? or anything wrong with my relationship?</p>
  
  <p>Please help..!</p>