zoukankan      html  css  js  c++  java
  • mybatis使用

        mybatis的一个重大好处是可写动态的sql,否则我们还需要在代码中判断

       关于@param注解的使用,关于<foreach>标签中collection的使用,这两篇博文有很好的解释。@Param的原理是将@Param注解的编码封装成了map,所以在使用Map参数据的接口中,不应该使用@Param注解。

    mybatis中相关的报错:

    The error may involve defaultParameterMap
    ### The error occurred while setting parameters
    ### SQL: select * from news where news_abstract like %?% and item1 = ?
    ### Cause: java.sql.SQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '%'abstract'% and
    item1 = 'dsdzfs'' at line 1
    ; bad SQL grammar []; nested exception is java.sql.SQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '%'abstract'% and
    item1 = 'dsdzfs'' at line 1] with root cause

    java.sql.SQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '%'abstract'% and
    item1 = 'dsdzfs'' at line 1

      近期的数据库和批量查询写法,让我对mybatis中的mapper文件的写法更加熟练了。

    参考博文:https://blog.csdn.net/lgc592519828/article/details/79749972?utm_source=blogkpcl1

    参考博文:https://www.cnblogs.com/fnlingnzb-learner/p/10566452.html

  • 相关阅读:
    linux压缩与解压
    simple 单例
    模板字符串
    变量的解构赋值
    let和const关键字
    React的基本认识
    Docker安装Nginx
    jenkins创建工程
    Jenkins系统初始化配置
    在CentOS上使用Docker镜像安装Jenkins
  • 原文地址:https://www.cnblogs.com/Robin008/p/12716399.html
Copyright © 2011-2022 走看看