working with开发者_JS百科 JPA above hibernate impl. I map my enums by using user-type follow the good practice to store a persistence key to the enum and not the ordinal (which can be changed).
When i map columns from the inspected table, i do this: <property name=\"InstanceName\" type=\"MyNameUserType, MyApp.MyNamespace\">
I\'ve created a UserType (see below) to handle a situation in our mySQL database where we\'ve been saving null dates as 0000-00-00 00:00:00.