title: Hibernate unable to save entity with one of the fields as enum
body: <p>Here is the exception - 
  <a href="http://pastebin.com/9sNVjeRQ" rel="nofollow">pastebin</a></p>
  
  <pre><code>Caused by: java.sql.SQLException: Unknown Parameter: 13
      at com.google.cloud.sql.jdbc.ParameterMetadata.getParameterType(ParameterMetadata.java:45)
      at org.hibernate.type.EnumType.nullSafeSet(EnumType.java:121)
      at org.hibernate.type.CustomType.nullSafeSet(CustomType.java:155)
      at org.hibernate.persister.entity.AbstractEntityPersister.dehydrate(AbstractEntityPersister.java:2705)
      at org.hibernate.persister.entity.AbstractEntityPersister.dehydrate(AbstractEntityPersister.java:2682)
      at org.hibernate.persister.entity.AbstractEntityPersister$4.bindValues(AbstractEntityPersister.java:2863)
      at org.hibernate.id.insert.AbstractReturningDelegate.performInsert(AbstractReturningDelegate.java:57)
      ... 111 more
  </code></pre>
  
  <p>Enum's in my hibernate mapping - </p>
  
  <pre><code>&lt;property name="userStatus" column="user_status" insert="true" update="true" index="true"&gt;
    &lt;type name="org.hibernate.type.EnumType"&gt;
      &lt;param name="enumClass"&gt;com.tutorial.enums.UserStatus&lt;/param&gt;
      &lt;param name="type"&gt;12&lt;/param&gt;
    &lt;/type&gt;
  &lt;/property&gt;
  &lt;property name="userType" column="user_type" insert="true" update="true" index="true"&gt;
    &lt;type name="org.hibernate.type.EnumType"&gt;
      &lt;param name="enumClass"&gt;com.tutorial.enums.UserType&lt;/param&gt;
      &lt;param name="type"&gt;12&lt;/param&gt;
    &lt;/type&gt;
  &lt;/property&gt;
  </code></pre>
  
  <p>My entity has UserType and UserStatus as enums. Hibernate is not able to convert enums properly. Should I switch back to hibernate 3 because in another project(with hibernate 3)I had my own custom type and it was working perfectly fine. I'm right now using hibernate 4.1.7.</p>