Reputation: 86747
how can I insert SQL value for eg:
class MyEnum {
FOO, BAR
}
which is later mapped to a MyEnum property = MyEnum.FOO
;
How can I
INSERT into XX (property) values ('FOO')
?
When I try it like this, I get:
Data conversion error converting "'FOO' (MYENUM INTEGER)";
Upvotes: 2
Views: 1866
Reputation: 536
you have to map java enum to hibernate. this and this might help.
Upvotes: 1
Reputation: 2339
you got to convert your enum into a hibernate user type and change the mapping of the column to the UserType
class. take a look at this Reference
Upvotes: 0