How to insert data of type java.util.Set into mysql db column of type set(mysql set type) ?
My POJO :
public class UserTEO
{
private Integer id;
private Set changedfieldset;
//getters and setters
}
xml file :
<sqlMap namespace="user">
<typeAlias alias="USER" type="com.howtodoinjava.ibatis.demo.dto.UserTEO" />
<insert id="addUser" parameterClass="USER">
INSERT INTO USERINFO (ID,CHANGEDFIELDSET)
VALUES(#id#,#changedfieldset#);
</insert>
</sqlMap>
database :
CREATE TABLE USERINFO
(
ID INT,
CHANGEDFIELDSET SET('')
);
Exception :
com.ibatis.common.jdbc.exception.NestedSQLException:
--- The error occurred in user.xml.
--- The error occurred while applying a parameter map.
--- Check the user.addUser-InlineParameterMap.
--- Check the parameter mapping for the 'changedfieldset' property.
Please help. Thanks !