碰到Cause: java.lang.ArrayIndexOutOfBoundsException: 1; nested exception is com.ibatis.common.jdbc.exception.NestedSQLException 这个问题
原来是数据库中存在dbtrade,但是customInfo不存在,直接update导致的.
//A.存在付款时间,则表示已经统计过
if(dbtrade!=null && dbtrade.getPay_time()!=null){
//更新用户基本信息
fillCustomBaseInfo(trade,dbcustomInfo);
topApplicationDao.update("top.trade.updateCustom", dbcustomInfo);
return dbcustomInfo;
}
<update id="updateCustom">
update custom_info set
name=#name#,
state=#state#,
city=#city#
where xxx_nick=#xxx_nick# and nick=#nick#
</update>
这段代码的问题.
因为dbcustomInfo 为null 转化的时候报错导致
代码修改成问题解决
if(dbtrade!=null && dbtrade.getPay_time()!=null){
if(dbcustomInfo==null){
dbcustomInfo = createCustomByTrade(trade, dbcustomInfo, comUid, sid, comCacheTools);
return dbcustomInfo;
}
//更新用户基本信息
fillCustomBaseInfo(trade,dbcustomInfo);
topApplicationDao.update("top.trade.updateCustom", dbcustomInfo);
return dbcustomInfo;
}
=====================详细错误=====================
[ERROR] 2013-06-21 21:30:19.161 com.hupun.crmbatch.service.trade.TOPTradeImporter 更新用户信息统计失败!
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 top.trade.updateCustom-InlineParameterMap.
--- Check the parameter mapping for the 'name' property.
--- Cause: java.lang.ArrayIndexOutOfBoundsException: 1; nested exception is com.ibatis.common.jdbc.exception.NestedSQLException:
--- The error occurred while applying a parameter map.
--- Check the top.trade.updateCustom-InlineParameterMap.
--- Check the parameter mapping for the 'name' property.
--- Cause: java.lang.ArrayIndexOutOfBoundsException: 1
at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:83)
at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:80)
at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:80)
at org.springframework.orm.ibatis.SqlMapClientTemplate.execute(SqlMapClientTemplate.java:203)
at org.springframework.orm.ibatis.SqlMapClientTemplate.update(SqlMapClientTemplate.java:378)
at com.hupun.crmbatch.dao.AbstractIbatisDaoSupport.update(AbstractIbatisDaoSupport.java:120)
at com.hupun.crmbatch.service.trade.TOPTradeImporter.updateCustomSummary(TOPTradeImporter.java:330)
at com.hupun.crmbatch.service.trade.TOPTradeImporter.store(TOPTradeImporter.java:133)
at com.hupun.crm.test.top.trade.TopTradeDownloadTest.testNotExistCustom(TopTradeDownloadTest.java:209)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
at com.taobao.itest.core.statements.RunBeforeTestMethod.evaluate(RunBeforeTestMethod.java:54)
at com.taobao.itest.core.statements.RunAfterTestMethod.evaluate(RunAfterTestMethod.java:60)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:76)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)