title: Hibernate HQL casting: java.lang.String cannot be cast to java.lang.Enum
body: <p>I am getting this problem:</p>
  
  <pre><code>java.lang.String cannot be cast to java.lang.Enum
  </code></pre>
  
  <p>When I try this <em>HQL</em>:</p>
  
  <pre><code>...
  query = em.createQuery("SELECT object from Entity object where object.column = ?");
  query.setParameter(1, "X");
  return query.getResultList();
  </code></pre>
  
  <p>Where in DB the <em>type</em> is a <em>Varchar2(x)</em> with a check constraint and the variable in the entity is defined with <em>Enum</em> using the tag @Enumerated(EnumType.STRING):</p>
  
  <pre><code>public enum ColumnEnum {
      X, Y;
  }
  </code></pre>