Currently, I have a table that has a column which has a datatype enum. My question is can I execute a IN query on this column?
For example:
enum Gender { MALE, FEMALE, GAY };
Table Student (
String name;
Gender gender;
)
Can I execute:
SELECT * FROM Student WHERE gender IN ('MALE', 'FEMALE');
Note that I use string as the parameter for in, but I’m getting:
Caused by: java.lang.IllegalArgumentException: Parameter value [('MALE')] did not match expected type [Gender]
Is there a workaround on this issue?
Thanks,
czetsuya
Since string values are not recognised, execute the following code (Assuming you have used Enum with default EnumType):
If using EnumType.String