嗨我想通过ibatis插入对象列表,但我得到一个异常,如 org.apache.ibatis.mapping.SqlMapperException:表达式'boxlist'评估为空值。Ibatis插入操作
<insert id="insertList" parameterType="java.util.List">
INSERT INTO boxtable (
size,length)
VALUES
<foreach item="box" collection="boxList" separator=",">
(#{box.size},#{box.length})
</foreach>
</insert>
吾道类就像
public void insert(List<box> boxList)
throws SQLException {
try {
sqlSession = sqlSessionFactory.openSession(AUTO_COMMIT);
int status = sqlSession.insert("insertlist", boxList);
logger.debug("status :: " + status);
sqlSession.commit();
} catch (Throwable ee) {
logger.error("e", ee);
sqlSession.rollback();
} finally {
sqlSession.close();
}
}
谁能帮助我???
错误信息很清楚我认为。你发送到表达式的值计算为'null' – NilsH
没有列表不是空的..我从其他函数调用该函数并传递列表 –