Mybatis frame 3

review:

1.	多参数查询(@Param,对象)
2.	获取保存主键( select last_insert_id )
3.	动态SQL( if, choose when otherwise, where,set ,trim,foreach )
4.	多表操作(一对一,一对多)
  1. Nested queries (focus)
    nested query: multiple table joins query SQL statement, split into multiple queries (single-table queries)
    1.1 one
    case: the user query belongs to all accounts and each account
    1.1.1 distinguish the operating body
    operating body: accounts
    1.1.2 to complete multiple queries
    SQL statement
    Here Insert Picture Description
    1.1.3 mapping configuration file
    to configure the mapping file operations on the main body of
    Here Insert Picture Description
    1.2-to-many
    case: query all accounts in all users, and each user
    1.2.1 distinguish the operating body
    operating body: user
    1.2.2 multiple queries
    Here Insert Picture Description
    1.2.3 mapping configuration file
    Here Insert Picture Description
  2. Loading strategy
    loading strategy: query time associated with the query object
    is loaded immediately: after the query object, instantly check the associated object (the default configuration)
    delay loading (lazy loading): associated objects, when to use, when to check
    2.1 local configuration
配置到SQL映射文件的关联关系配置上 (association, collection)
fetchType:
	eager
	lazy

Here Insert Picture Description
2.2 Global disposed
in the core configuration file is loaded globally switch
Here Insert Picture Description
develop methodologies trigger delay loading of
Here Insert Picture Description
the principles of 2.3 Internal
internal principle: based on dynamic proxy subclass (generated dynamic proxy object is a subclass of the proxy object)
l is proxy object can not be used final modification
Here Insert Picture Description
3. caching mechanism
3.1 cache
cache:.. SqlSession level cache with the creation of SqlSession created, with the closure and destruction procedures SqlSession comes, can not uninstall
Here Insert Picture Description
3.1.1 verify cache
Here Insert Picture Description
3.2 secondary cache
secondary cache:. SqlSessionFactory level cache (cache level Mapper)
Here Insert Picture Description
3.2.1 secondary cache configuration

  1. Interface objects need to implement serialization
    Here Insert Picture Description
  2. Global open second-level cache support
    .Here Insert Picture Description
  3. Declared in the mapping file you want to use secondary cache
    Here Insert Picture Description
  4. Saving data to the secondary cache, you are required to submit or close sqlSession
    Here Insert Picture Description
  5. Core Configuration (focus)
    Configuration Item core configuration file: sqlMapConfig
    4.1 the Properties
    in the core configuration file using an external properties profile
    Here Insert Picture Description
    4.2 typeAlias
    typeAlias: Set an alias is
    Here Insert Picture Description
    4.3 Mappers
    loaded sql mapping files
    Here Insert Picture Description
    4.4 Settings
    Global Configuration
    Here Insert Picture Description
    4.5 Rights to
    Here Insert Picture Description
    4.6 using self defined database connection pool
    4.6.1 coordinate
    Here Insert Picture Description
    4.6.2 custom factory
    Here Insert Picture Description
    4.6.3
    Here Insert Picture Description5. programming annotation
    action: replacing the SQL mapping file xml
    5.1 rule
1.	注解配置到dao接口的方法上
2.	注解中配置sql语句,sql语句的语法和xml映射文件中的语法一致
3.	注解 (@Insert, @Update,@Delete,@Select)

5.2 General Notes (Key)
5.2.1 build environment
package name added to a whole class name dao interface mappers in the core configuration file or set dao interfaces in the form of a package
5.2.2
Here Insert Picture Description
5.3 mapping relationship

@Results : 声明映射关系配置
     id : 当前映射配置的唯一标识
     value : 接收@Result数组
@Result :
     配置属性和字段的映射关系
     property
     column
     id : boolean参数,表明是否配置主键映射关系(true|false)
         默认值:false
@ResultMap : 引用其他已经存在的映射关系配置
             value=其他Results中id

Result and Results
Here Insert Picture Description
resultMap
Here Insert Picture Description
5.4 multi-table notes (understand)
only supports nested queries
5.4.1 one-
Here Insert Picture Description
5.4.2-many
Here Insert Picture Description
interview questions

  1. Delayed loading strategy
  2. Caching
    operations:
    1. Exercise 2 preview the first day of spring.

Guess you like

Origin blog.csdn.net/AdamCafe/article/details/90680002