• 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

  • 相关阅读:
    $.getJSON()
    seconds
    ini_set
    validation
    component
    ini_set();
    长期阅读英文技术博客的好处
    用xml还是json
    单​手​打​字
    洛谷P1141 01迷宫
  • 原文地址:https://www.cnblogs.com/Robin008/p/12716399.html
Copyright © 2020-2023  润新知