Mybatis essay notes

Fundamentals

  • ORM:object-relation-Mapping
  • Table - Class / Properties - Column / Object - OK
  • Mapping file with the alternate code / modify the configuration file / files modify properties
  • Generator command
  • Support for custom SQL, eliminating all manual settings, and the result set JDBC code and parameter retrieval
  • Do:
    • Reverse engineering mapping file generated Mapper
  • Step Note:
    • mybatis must log4j
    • pom jar package plus support
    • mybatis.properties file
    • Reverse engineering mapping file generation Mapper

    • Ready mybatis-Config.xml configuration file (mybatis must be used independently of the time)
    • Write test classes
    • The latter do not have more than two points

  • Mapping file corresponds to the interface implementation class
  • Dao can only write CRUD
  • The presence of multiple primary foreign key relationships between tables tables, classes and also the mapping class. Association class to the mapping table using the primary foreign key relationship.
  • Generalization: parent-child class inherits
  • Implementation: the interface between
  • Dependency: A calls B, B also becomes variable A
  • Association: a class holds another class as its attributes, is used to describe primary foreign key relationship

Mybatis dynamic SQL

  • Inquire
    • where + if
    • choose
    • foreach
  • insert
    • trim + if
  • Update
    • set + if
  • Delete: No

Springboot + Mybatis integration

  • MVC /Controller + View +Model
  • Springboot :Controller层
  • Mybatis: Dao layer

Guess you like

Origin www.cnblogs.com/Zhangyilin/p/11334007.html