MyException - 我的异常网
输入您需解决的 软件开发问题并开始搜索, 我的异常网可以方便地提供各类 程序错误解决方案。
当前位置: 我的异常网 » J2EE

错误原因:org.springframework.jdbc.UncategorizedSQLException: (2)


at org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:65)
at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:345)
at $Proxy0.selectOne(Unknown Source)
at org.mybatis.spring.SqlSessionTemplate.selectOne(SqlSessionTemplate.java:158)
at cn.machi.framework.dao.impl.BaseDAOImpl.get(BaseDAOImpl.java:66)
at cn.machi.framework.dao.impl.BaseDAOImpl$$FastClassByCGLIB$$fd01e960.invoke(<generated>)
at net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy.java:149)
at org.springframework.aop.framework.Cglib2AopProxy$CglibMethodInvocation.invokeJoinpoint(Cglib2AopProxy.java:688)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
at org.springframework.aop.aspectj.AspectJAfterAdvice.invoke(AspectJAfterAdvice.java:42)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.springframework.aop.aspectj.AspectJAfterThrowingAdvice.invoke(AspectJAfterThrowingAdvice.java:55)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:89)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.springframework.aop.framework.Cglib2AopProxy$DynamicAdvisedInterceptor.intercept(Cglib2AopProxy.java:621)
at cn.machi.oa.atte.dao.impl.LeaveApplyDAOImpl$$EnhancerByCGLIB$$5c7d549c.get(<generated>)
at cn.machi.oa.atte.service.impl.LeaveApplyServiceImpl.computeTotalHour(LeaveApplyServiceImpl.java:313)


在网上找了很多类似的问题,都没能解决,不知何故,
这里说明一下,数据库是Oracle,连接池是c3p0
当调用没有返回值的存储过程时是正常的,有返回参数的都报这样的错。不知是我的写法不对还是jar包的问题。
求解!

------解决方案--------------------------------------------------------
不懂
友情帮顶
...
------解决方案--------------------------------------------------------
楼主用的是什么数据库的驱动包
据说是需要更换oracle的驱动包
------解决方案--------------------------------------------------------
这个是你的SQL有问题
存储过程写的不正确
你把这些参数
 Parameters: 11050020(String), 2011-06-15 09:21:00.0(Timestamp), 2011-06-15 20:21:00.0(Timestamp), 1005(String), 0(String), 0(String)

替换到存储过程中 用SQL直接调用看是否报错
------解决方案--------------------------------------------------------
XML code

<select id="LeaveCheck"  parameterMap="LeaveApplyDetailMap">
        CALL PKG_ATT.SP_Get_LeaveCheck(#{strEmployeeNo},#{beginDate},#{endDate},#{typeNo},#{resultCode},#{resultData})
    </select>


换成

<procedure id="LeaveCheck"  parameterMap="LeaveApplyDetailMap">
        {CALL PKG_ATT.SP_Get_LeaveCheck(?,?,?,?,?,?)}
</procedure>

试试

------解决方案--------------------------------------------------------
ibatis调用存储过程 
一般数据量大的话 是先执行存储过程

将数据插入到临时表里

然后通过查询临时表 将数据显示

并不是你想的 直接些个调用存储过程的配置 正好将数据返回出来
存储过程的配置只能返回游标
------解决方案--------------------------------------------------------
好像报的还是环境问题,更换跟换包吧。

再试试。
------解决方案--------------------------------------------------------
问题解决了,楼楼主可以结贴了,你是否也有自定义的分页工具插件?有的就修改下
StatementHandler handler = (StatementHandler) ReflectUtil
.getFieldValue(statement, "delegate");

// 增加CallableStatementHandler判断,如果是存储过程,则不执行下面的过程
if (handler instanceof PreparedStatementHandler)
{
.......
}

增加一个判断,就不会强行转化成preparedstatement了,呵呵
软件开发 程序错误 异常 Exception Copyright © 2009-2012 MyException 版权所有