0

次のようなリストである変数を持つオブジェクトがあります。

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);
    }
}

このための ResultMap を定義しました...

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);

CommaSeparatedStringListTypeHandlerを定義していますが、オブジェクトを INSERT しようとするとエラーが発生します。私が理解している限り、INSERT は ResultMap を使用しないため、TypeHandler が表示されないため、List エラーをどう処理するかわかりません。

これは、現在のセットアップで発生するエラーです...

Caused by: org.apache.ibatis.executor.ExecutorException: There was no TypeHandler found for parameter errors of statement ....dao.ExportQueueDao.insertOrUpdate

MyBatisがList<String> errors.

4

1 に答える 1