zoukankan      html  css  js  c++  java
  • MyBatis遇到问题

    1、根据主键查询时候 shipperMapper.selectByPrimaryKey(uid),报错
    是因为主键没有设置@Id
    解决:在主键上设置@Id,错误解决
    2019-12-18 09:41:22,453 [http-nio-8670-exec-8] ERROR adminLogger -[ExceptionHandlerAdvice.java:67]- 运行异常
    org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.type.TypeException: Could not set parameters for mapping: ParameterMapping{property='accountStatus', mode=IN, javaType=class java.lang.Integer, jdbcType=null, numericScale=null, resultMapId='null', jdbcTypeName='null', expression='null'}. Cause: org.apache.ibatis.type.TypeException: Error setting non null for parameter #11 with JdbcType null . Try setting a different JdbcType for this parameter or a different configuration property. Cause: java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Integer
    	at org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:77)
    	at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:446)
    	at com.sun.proxy.$Proxy119.selectOne(Unknown Source)
    

     2、出现以下问题,是包导入错了,

    正确的
    import org.apache.ibatis.annotations.Param;
    错误的
    import io.lettuce.core.dynamic.annotation.Param;
    Caused by: org.apache.ibatis.reflection.ReflectionException: There is no getter for property named 'params' in 'class com.health.model.BpUser'
        at org.apache.ibatis.reflection.Reflector.getGetInvoker(Reflector.java:419)
        at org.apache.ibatis.reflection.MetaClass.getGetInvoker(MetaClass.java:164)
        at org.apache.ibatis.reflection.wrapper.BeanWrapper.getBeanProperty(BeanWrapper.java:162)
        at org.apache.ibatis.reflection.wrapper.BeanWrapper.get(BeanWrapper.java:49)
        at org.apache.ibatis.reflection.MetaObject.getValue(MetaObject.java:122)
        at org.apache.ibatis.scripting.xmltags.DynamicContext$ContextMap.get(DynamicContext.java:94)
        at org.apache.ibatis.scripting.xmltags.DynamicContext$ContextAccessor.getProperty(DynamicContext.java:108)
        at org.apache.ibatis.ognl.OgnlRuntime.getProperty(OgnlRuntime.java:2685)
        at org.apache.ibatis.ognl.ASTProperty.getValueBody(ASTProperty.java:114)
        at org.apache.ibatis.ognl.SimpleNode.evaluateGetValueBody(SimpleNode.java:212)
  • 相关阅读:
    LeetCode OJ String to Integer (atoi) 字符串转数字
    HDU 1005 Number Sequence(AC代码)
    HDU 1004 Let the Balloon Rise(AC代码)
    HDU 1003 Max Sum(AC代码)
    012 Integer to Roman 整数转换成罗马数字
    011 Container With Most Water 盛最多水的容器
    010 Regular Expression Matching 正则表达式匹配
    007 Reverse Integer 旋转整数
    006 ZigZag Conversion
    005 Longest Palindromic Substring 最长回文子串
  • 原文地址:https://www.cnblogs.com/L-Y-F/p/12058194.html
Copyright © 2011-2022 走看看