SQL insert with enums?

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)";

Answers


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


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


Need Your Help

pdf estimation with scipy.stats

python statistics scipy

Say I compute the density of Beta(4,8):

set title to JFrame

java eclipse swing jframe super

I am new to Java. My problem is that I have a class names MyClassExp. I have extended it from JFrame. Inside the class, I initiate an object of another class named TabbedFrame. TabbedFrame also ext...