I have an object that has a variable that's a List like so:
ExportQueue.java
public class ExportQueue implements Serializable {
private List<String> errors;
public List<String> getErrors() {
return errors;
}
public void setErrors(List<String> errors) {
this.errors = errors;
}
public void addError(String error) {
if(this.errors == null) this.errors = new ArrayList<String>();
this.errors.add(error);
}
}
I've defined the ResultMap for this...
ExportQueueDao.xml
<mapper namespace="...">
<resultMap id="exportQueueResultMap" type="...ExportQueue">
<result property="errors" column="errors"
typeHandler="...CommaSeparatedStringListTypeHandler" />
</resultMap>
</mapper>
ExportQueueDao.java
@Insert(INSERT_UPDATE)
@Options(useGeneratedKeys = true, keyProperty = "id")
int insertOrUpdate(ExportQueue ExportQueue);
I have a CommaSeparatedStringListTypeHandler defined but I'm getting an error when I try to INSERT the object. As far as I understand INSERT doesn't use the ResultMap and therefore doesn't see the TypeHander so it doesn't know what to do with the List errors.
This is the error I get with the current set up...
Caused by: org.apache.ibatis.executor.ExecutorException: There was no TypeHandler found for parameter errors of statement ....dao.ExportQueueDao.insertOrUpdate
How do I configure this so MyBatis knows what to do with the List<String> errors
?