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传进去的是有值的啊。