title: Spring Jpa Projection interface occur error with Boolean type
body: <h3 id="q.why-jpa-projection-cant-convert-mysql-bit1-to-java-boolean-fjny">Q. Why JPA Projection can't convert <code>Mysql bit(1)</code> to <code>Java Boolean</code>?</h3>
  <p>Spring Jpa Projection occur error <code>Projection type must be an interface!</code> when the Mysql <code>bit(1)</code> type maps to the Java <code>Boolean</code> type.</p>
  <p>Jpa converts a Boolean column in Entity class to bit(1) column in Mysql Table.</p>
  <p>If I change <code>getIsBasic</code>'s type in PlanInfoProjection interface <code>Integer</code> to <code>Boolean</code>, It doesn't work. Why does it occur error?</p>
  <h3 id="jpa-repository-2tfo">JPA Repository</h3>
  <pre><code>@Query(nativeQuery=true, value=&quot;select true as isBasic from dual&quot;)
  ProductOrderDto.PlanInfoProjection findPlanInfoById(Long id);
  </code></pre>
  <h3 id="projection-interface-r5s0">Projection interface</h3>
  <pre><code>public class ProductOrderDto {
  
      @Getter
      public static class PlanInfo {
          private Boolean isBasic;
  
          public PlanInfo(PlanInfoProjection projection) {
              // this.isBasic = projection.getIsBasic(); //&lt;-- I want to use like this.
              if (projection.getIsBasic() == null) {
                  this.isBasic = null;
              } else {
                  this.isBasic = projection.getIsBasic() == 0 ? false : true; // &lt;-- I have to convert
              }
          }
      }
      public interface PlanInfoProjection {
          Integer getIsBasic();    // It works, but I have to convert Integer to Boolean to use. 
          //Boolean getIsBasic();  // doesn't work, but why???
          //Boolean isBasic();     // also doesn't work
          //boolean isBasic();     // also doesn't work
      }
  }
  </code></pre>