judge wrote:
I've been seacrhing for a way to map enums to varchar columns for a long time usinh .hbm files. This post gave me the clue I needed, so for everyone looking for this solution. This is how you modify the mapping above to map to varchars:
<property name="myfield" length="30">
<type name="org.hibernate.type.EnumType">
<param name="enumClass">org.judge.myenum</param>
<param name="type">12</param>
</type>
</property>
The number 12 is one of the constants from java.sql.Types.
Can anyone provide a good explanation regarding the usage of EnumType: The parameters needed and their meaning. For example: Why hardcoding 12?
I couldn't any good explanation while Googling.
Asaf