2

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)";
user219882
  • 15,274
  • 23
  • 93
  • 138
membersound
  • 81,582
  • 193
  • 585
  • 1,120

2 Answers2

1

you have to map java enum to hibernate. this and this might help.

Alex Navasardyan
  • 536
  • 5
  • 12
0

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

Nitin Chhajer
  • 2,299
  • 1
  • 24
  • 35