sdw110713120 2011-08-20 18:07
浏览 3067
已采纳

ibatis 问题:Unable to translate SQLException with Error code '0', will now try the

xml文件:
[code="java"]
<!-- 动态插入数据 -->


insert into $tableName$


#colName[]#

values

#colValue[]#



[/code]

里面的colName和colValue都是List型的,都在ColInfo 类里。
service:
[code="java"] public void commonInsert(ColInfo colInfo) {
System.out.println("------------------------------");
System.out.println(colInfo.getColName().size());
System.out.println(colInfo.getColValue().size());
System.out.println("------------------------------");
sqlMapClientTemplate.insert("commonInsert", colInfo);
}
[/code]
可以确定有值输出。
报错:

[quote]org.springframework.jdbc.UncategorizedSQLException: SqlMapClient operation; uncategorized SQLException for SQL []; SQL state [null]; error code [0]; --- The error occurred while applying a parameter map. --- Check the commonInsert-InlineParameterMap. --- Check the parameter mapping for the 'colName[0]' property. --- Cause: java.lang.NullPointerException; nested exception is com.ibatis.common.jdbc.exception.NestedSQLException: --- The error occurred while applying a parameter map. --- Check the commonInsert-InlineParameterMap. --- Check the parameter mapping for the 'colName[0]' property. --- Cause: java.lang.NullPointerException [/quote]

请各位大大看看哪里的错啊?colName传进去的是有值的啊。

  • 写回答

4条回答 默认 最新

  • Lionroo 2011-08-22 11:11
    关注

    抱歉, 刚才笔误, #应该包围[], 应该写成这样 colName#[]#

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(3条)

报告相同问题?

悬赏问题

  • ¥15 素材场景中光线烘焙后灯光失效
  • ¥15 请教一下各位,为什么我这个没有实现模拟点击
  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 保护模式-系统加载-段寄存器