How to define UserType' s name globally in Hibernate?
It's possible to use @TypeDefs annotation to define sh开发者_如何学Pythonort type name for a UserType. But how to define it for entire application?
You can give a basic value type name (see http://docs.jboss.org/hibernate/core/3.6/reference/en-US/html_single/#mapping-types-basictypes) to your UserType class, making that class the substitute of the standard class.
For example:
<typedef name="string"
class="com.foo.hibernate.userType.NewStringUserType"></typedef>
精彩评论