问题描述
使用的firebird数据库,运行一段时间就会报以下错误。但是感觉代码没有问题啊,不知道问题出在哪里了。。。INFO|jvm1|2014/07/1222:32:42|com.ibatis.common.jdbc.exception.NestedSQLException:INFO|jvm1|2014/07/1222:32:42|---Theerroroccurredincom/emerson/upscoutersrvr/sql/firebird/System.xml.INFO|jvm1|2014/07/1222:32:42|---Theerroroccurredwhileexecutingmappedstatement.INFO|jvm1|2014/07/1222:32:42|---ChecktheSystem.updateRealData.INFO|jvm1|2014/07/1222:32:42|---Checkthestatementortheresultmap.INFO|jvm1|2014/07/1222:32:42|---Cause:java.lang.reflect.UndeclaredThrowableExceptionINFO|jvm1|2014/07/1222:32:42|atcom.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeUpdate(GeneralStatement.java:94)INFO|jvm1|2014/07/1222:32:42|atcom.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.update(SqlMapExecutorDelegate.java:505)INFO|jvm1|2014/07/1222:32:42|atcom.ibatis.sqlmap.engine.impl.SqlMapSessionImpl.update(SqlMapSessionImpl.java:90)INFO|jvm1|2014/07/1222:32:42|atcom.ibatis.sqlmap.engine.impl.SqlMapClientImpl.update(SqlMapClientImpl.java:67)INFO|jvm1|2014/07/1222:32:42|atcom.emerson.upscoutersrvr.util.CommonDAO.executeUpdate(CommonDAO.java:202)INFO|jvm1|2014/07/1222:32:42|atcom.emerson.upscoutersrvr.device.NetAccessDevice.processRealData(NetAccessDevice.java:959)INFO|jvm1|2014/07/1222:32:42|atcom.emerson.upscoutersrvr.device.NetAccessDevice.process(NetAccessDevice.java:607)INFO|jvm1|2014/07/1222:32:42|atcom.emerson.upscoutersrvr.device.UpsDevice.run(UpsDevice.java:716)INFO|jvm1|2014/07/1222:32:42|atjava.lang.Thread.run(UnknownSource)INFO|jvm1|2014/07/1222:32:42|Causedby:java.lang.reflect.UndeclaredThrowableExceptionINFO|jvm1|2014/07/1222:32:42|atorg.firebirdsql.jdbc.FBStatementFactory.createPreparedStatement(FBStatementFactory.java:101)INFO|jvm1|2014/07/1222:32:42|atorg.firebirdsql.jdbc.AbstractConnection.prepareStatement(AbstractConnection.java:869)INFO|jvm1|2014/07/1222:32:42|atorg.firebirdsql.jdbc.AbstractConnection.prepareStatement(AbstractConnection.java:824)INFO|jvm1|2014/07/1222:32:42|atorg.firebirdsql.jdbc.AbstractConnection.prepareStatement(AbstractConnection.java:817)INFO|jvm1|2014/07/1222:32:42|atorg.firebirdsql.jdbc.AbstractConnection.prepareStatement(AbstractConnection.java:293)INFO|jvm1|2014/07/1222:32:42|atsun.reflect.GeneratedMethodAccessor10.invoke(UnknownSource)INFO|jvm1|2014/07/1222:32:42|atsun.reflect.DelegatingMethodAccessorImpl.invoke(UnknownSource)INFO|jvm1|2014/07/1222:32:42|atjava.lang.reflect.Method.invoke(UnknownSource)INFO|jvm1|2014/07/1222:32:42|atcom.ibatis.common.jdbc.SimpleDataSource$SimplePooledConnection.invoke(SimpleDataSource.java:958)INFO|jvm1|2014/07/1222:32:42|at$Proxy0.prepareStatement(UnknownSource)INFO|jvm1|2014/07/1222:32:42|atcom.ibatis.sqlmap.engine.execution.SqlExecutor.prepareStatement(SqlExecutor.java:494)INFO|jvm1|2014/07/1222:32:42|atcom.ibatis.sqlmap.engine.execution.SqlExecutor.access$000(SqlExecutor.java:39)INFO|jvm1|2014/07/1222:32:42|atcom.ibatis.sqlmap.engine.execution.SqlExecutor$Batch.addBatch(SqlExecutor.java:583)INFO|jvm1|2014/07/1222:32:42|atcom.ibatis.sqlmap.engine.execution.SqlExecutor.addBatch(SqlExecutor.java:104)INFO|jvm1|2014/07/1222:32:42|atcom.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.sqlExecuteUpdate(GeneralStatement.java:197)INFO|jvm1|2014/07/1222:32:42|atcom.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeUpdate(GeneralStatement.java:78)INFO|jvm1|2014/07/1222:32:42|...8moreINFO|jvm1|2014/07/1222:32:42|Causedby:java.lang.ArrayIndexOutOfBoundsException:0INFO|jvm1|2014/07/1222:32:42|atorg.firebirdsql.gds.impl.wire.AbstractJavaGDSImpl.parseSqlInfo(AbstractJavaGDSImpl.java:2349)INFO|jvm1|2014/07/1222:32:42|atorg.firebirdsql.gds.impl.wire.AbstractJavaGDSImpl.iscDsqlDescribeBind(AbstractJavaGDSImpl.java:1118)INFO|jvm1|2014/07/1222:32:42|atorg.firebirdsql.gds.impl.GDSHelper.prepareStatement(GDSHelper.java:196)INFO|jvm1|2014/07/1222:32:42|atorg.firebirdsql.jdbc.AbstractStatement.prepareFixedStatement(AbstractStatement.java:1119)INFO|jvm1|2014/07/1222:32:42|atorg.firebirdsql.jdbc.AbstractPreparedStatement.prepareFixedStatement(AbstractPreparedStatement.java:1176)INFO|jvm1|2014/07/1222:32:42|atorg.firebirdsql.jdbc.AbstractPreparedStatement.<init>(AbstractPreparedStatement.java:124)INFO|jvm1|2014/07/1222:32:42|atorg.firebirdsql.jdbc.FBPreparedStatement.<init>(FBPreparedStatement.java:41)INFO|jvm1|2014/07/1222:32:42|atsun.reflect.GeneratedConstructorAccessor6.newInstance(UnknownSource)INFO|jvm1|2014/07/1222:32:42|atsun.reflect.DelegatingConstructorAccessorImpl.newInstance(UnknownSource)INFO|jvm1|2014/07/1222:32:42|atjava.lang.reflect.Constructor.newInstance(UnknownSource)INFO|jvm1|2014/07/1222:32:42|atorg.firebirdsql.jdbc.FBStatementFactory.createPreparedStatement(FBStatementFactory.java:90)INFO|jvm1|2014/07/1222:32:42|...23more执行语句如下:<updateid="updateRealData"parameterClass="java.util.Map">UPDATESIGNALSETREAL_VALUE_NR=#realValve#<isNotEmptyprepend=","property="alarmSign">ALARM_SIGN_TX=#alarmSign#</isNotEmpty>WHEREEQUIP_ID=#deviceId#ANDSIGNAL_NR=#channel#</update>源码简化如下:Mapparam=newWeakHashMap();param.put("deviceId",getDeviceId());startTransaction();this.startBatch();for(inti=0;i<realDataSize;i++){Stringstatus="0";try{floatfRealValue=0;if(isUpdateSignalData()||!(upsRealDataStatus.get(i).equals(oldStatus.get(i)))){param.put("alarmSign",status);param.put("channel",newShort((short)(i+1)));//信号ID+1param.put("realValve",newFloat(fRealValue));executeUpdate("System.updateRealData",param);}}this.executeBatch();commitTransaction();}catch(Exceptione){e.printStackTrace();}finally{endTransaction();}
解决方案
解决方案二:
反射的时候字段对不上。parameterClass为什么不用javabean?
解决方案三:
感觉使用map也能实现,而且我的字段名和sql中的都是一样的啊
解决方案四:
引用2楼xn_xuke的回复:
感觉使用map也能实现,而且我的字段名和sql中的都是一样的啊
不是光字段名一样就能映射上,你看看ibatis的用map的文档。