delyyangs
delyyangs
2019-03-16 09:58

Mybaits调用存储过程报错There is no setter for property named 'result' in 'class java.lang.Class'

  • java

存储过程:
CREATE PROCEDURE my_test (OUT result VARCHAR(10))
BEGIN
SELECT DATE_FORMAT(NOW(),'%Y%m%d') INTO result;
-- SELECT result;
END

Mybatis调用

CALL my_test (#{result,mode=OUT,jdbcType=VARCHAR})

报错:
严重: Servlet.service() for servlet [spring] in context with path [/MyBatis_06_ssm] threw exception [Request processing failed; nested exception is org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.reflection.ReflectionException: Could not set property 'result' of 'class java.lang.Class' with value '_20190316_' Cause: org.apache.ibatis.reflection.ReflectionException: There is no setter for property named 'result' in 'class java.lang.Class'] with root cause
org.apache.ibatis.reflection.ReflectionException: There is no setter for property named 'result' in 'class java.lang.Class'
at org.apache.ibatis.reflection.Reflector.getSetInvoker(Reflector.java:401)
at org.apache.ibatis.reflection.MetaClass.getSetInvoker(MetaClass.java:168)
at org.apache.ibatis.reflection.wrapper.BeanWrapper.setBeanProperty(BeanWrapper.java:177)
at org.apache.ibatis.reflection.wrapper.BeanWrapper.set(BeanWrapper.java:59)

如上mybatis调用存储过程报错,实际上是查询出了结果:20190316,就是在返回结果的时候报错了,不知道是存储过程的问题还是mybatis调用问题, 返回结果这里程序使用的是BeanWrapper,如果使用MapWrapper应该就没有问题,但不明白哪里出问题了,请大佬们帮忙啊!

  • 点赞
  • 回答
  • 收藏
  • 复制链接分享

1条回答