可以创建一个自定义
UserType(例如this)并从您的映射中使用它
<property name="type" not-null="true"> <type name="at.molindo.util.hibernate.EnumUserType"> <param name="enumClass"> com.example.MyEnum </param> </type></property>
编辑:Hibernate带有它自己的EnumType(因为在hibernate-annotations中为3.2,因为在hibernate-
core中为3.6-在撰写本文时不知道它在hibernate-annotation中,但请参见Diego的回答。



