title: why does hibernate map tinyint(1) to a java.lang.Boolean?
body: <p>Considering the following enum in Java:</p>
  
  <pre><code>public enum Color {
      RED,
      GREEN
  }
  </code></pre>
  
  <p>The definition in the JPA Entity</p>
  
  <pre><code>@Column(name = "COLOR")
  private Color color;
  </code></pre>
  
  <p>and the MySQL DDL:</p>
  
  <pre><code>`COLOR` tinyint(1) NOT NULL
  </code></pre>
  
  <p>Why does Hibernate 3.5 seem to always map the tinyint(1) to a java.lang.Boolean, leading to the following exception:</p>
  
  <pre><code>java.lang.ClassCastException: java.lang.Boolean cannot be cast to java.lang.String
      at org.hibernate.type.EnumType.nullSafeGet(EnumType.java:119)
      at org.hibernate.type.CustomType.nullSafeGet(CustomType.java:132)
      at org.hibernate.type.AbstractType.hydrate(AbstractType.java:105)
      at org.hibernate.persister.entity.AbstractEntityPersister.hydrate(AbstractEntityPersister.java:2267)
      at org.hibernate.loader.Loader.loadFromResultSet(Loader.java:1423)
      at org.hibernate.loader.Loader.instanceNotYetLoaded(Loader.java:1351)
      at org.hibernate.loader.Loader.getRow(Loader.java:1251)
      at org.hibernate.loader.Loader.getRowFromResultSet(Loader.java:619)
      at org.hibernate.loader.Loader.doQuery(Loader.java:745)
      at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:270)
      at org.hibernate.loader.Loader.doList(Loader.java:2294)
      at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2172)
      at org.hibernate.loader.Loader.list(Loader.java:2167)
      at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:448)
      at org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:363)
      at org.hibernate.engine.query.HQLQueryPlan.performList(HQLQueryPlan.java:196)
      at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1258)
      at org.hibernate.impl.QueryImpl.list(QueryImpl.java:102)
      at org.hibernate.ejb.QueryImpl.getSingleResult(QueryImpl.java:264)
  </code></pre>
  
  <p>This seems to be fixed easily by changing the DDL to tinyint(2). However, I was wondering if this is intended and why hibernate maps to a Boolean, even though it should know that this should be mapped as an enum.</p>