tags:

views:

137

answers:

1

Hi. With the regular statement (just statement) I can put java enums into the queries and it works just fine. With prepared statement I can't do this ?

+1  A: 

MySQL treats its enum type as string for queries. So you should be able to use PreparedStatement.setString() method and pass enum name to it:

preparedStatement.setString(1, MY_ENUM.name());

This assumes, of course, that names for your java and MySQL enums match.

ChssPly76