jdbctype for enum in parameterMap's parameter in IBATIS
posted 7 years ago
Hi, I am trying to update a table in mysql using ibatis and I have to update an enum value and I have given jdbctype for that property as varchar. when I am executing in I am getting an error as below.can someone help me in this regard. Please find the code below here strModRole is declared as enum in the procedure.
Hi Vishnu, You need to provide a type handler in case of custom types such as enums You need to write a class which will implement com.ibatis.sqlmap.client.extensions.TypeHandlerCallback and provide implementation for public Object getResult(ResultGetter getter)throws SQLException public void setParameter(ParameterSetter setter, Object parameter)throws SQLException
Here's a simple example of a boolean handler that uses "Yes" and "No":