title: HQL: Using Boolean in Named Queries
body: <p>Can you please help me? I have error in querying boolean value "r.isDefault = true".</p>
  
  <p>In my HQL named query:</p>
  
  <pre><code>&lt;named-query name="RptQuery.queryDefaultByCode"&gt;
      &lt;query&gt;
          SELECT r FROM RptQuery r WHERE r.code = ?1 AND r.isDefault = true
      &lt;/query&gt;
  &lt;/named-query&gt;
  </code></pre>
  
  <p>I get error:
      Caused by: org.hibernate.HibernateException: Errors in named queries: RptQuery.queryDefaultByCode</p>
  
  <p>In my persistence.xml:</p>
  
  <pre><code>&lt;property name="hibernate.query.substitutions" value="true='Y', false='N', yes='Y', no='N'"/&gt;
  </code></pre>
  
  <p>In my pojo:</p>
  
  <pre><code>private boolean isDefault;
  
  @Column(name = "CPMN_IS_DEFLT", length = 1)
  @Type(type = "yes_no")
  public boolean isDefault() {
      return this.isDefault;
  }
  
  public void setDefault(boolean isDefault) {
      this.isDefault = isDefault;
  }
  </code></pre>
  
  <p>Thank you in advance!</p>
  
  <p>Answer:
  Just found a minor error:</p>
  
  <pre><code>r.isDefault = true
  </code></pre>
  
  <p>should be</p>
  
  <pre><code>r.default = true
  </code></pre>
  
  <p>Thanks.</p>