title: Boolean column type (nullable true) in hibernate
body: <p>the problem is the following, i have an entity with a column.. say:</p>
  
  <pre><code>@Getter     
  @Setter
  @Column(name = "COLUMN_NAME", nullable = true)
  private Boolean flag;
  </code></pre>
  
  <p>As you can see the type is Boolean.. On the database it is a numeric column (NUMBER(1,0)). I'm trying to to perform a select and an insert in the table, through hibernate jpa so the select is a repository find and the insert is a saveAndFlush.
  This is the select:</p>
  
  <pre><code>public static final String query = "SELECT mgb FROM Entity mgb WHERE "
          + "( "
          +   "("
          +       "mgb.flag= :flag"
          +   ") OR "
          +   "(:flag IS NULL)"
          + ") AND "
          + "mgb.otherColumn IS NULL";
  @Query(query)
  public List&lt;Entity&gt;find(@Param("flag") Boolean flag);
  </code></pre>
  
  <p>This is the insert:</p>
  
  <pre><code>    Entity mgbi = new Entity();
      mgbi.setFlag(null);
      EntityRepository.saveAndFlush(mgbi); 
  </code></pre>
  
  <p>Both these operation throw me the same exception;</p>
  
  <pre><code>2014-11-26 17:50:25,279 WARN [org.hibernate.engine.jdbc.spi.SqlExceptionHelper] - &lt;SQL Error: 17004, SQLState: 99999&gt;
  2014-11-26 17:50:25,280 ERROR [org.hibernate.engine.jdbc.spi.SqlExceptionHelper] - &lt;Invalid column type: 16&gt;
  </code></pre>
  
  <p>I've done some attempt and i found out that if i change this line: <code>mgbi.setFlag(null);</code> to <code>mgbi.setFlag(true);</code> the error is not thrown any more and the insert is rightly done.</p>
  
  <p>I've found out on the web that the <code>boolean</code> type has this problem in java, but i've used the <code>Boolean</code> which should not act this weird.. AND, last but not least, i've an other entity, with almost the same column (even the name is the same), on the same database, with the same data types involved both from the java and from the db (oracle) point of view, it doesn't give me ANY error..</p>
  
  <p>So i'm quite confused..</p>
  
  <p>If someone could point me in the right direction i would be glad..</p>