The first stage

  • Get UserMapper’s proxy object through the JDK dynamic proxy

The second stage

  • Get MapperMethod objects (instances) into two properties SqlCommand and MehodSignature

    • SqlStatement (name and SqlCommand type SELECT or INSERT, etc.)
    • Gets MehodSignature to maintain method signatures, such as method return value types, input parameters, and so on

Phase 3 (Determine which method in the SQLSession to call)

  • Perform excute

  • Go through a different process based on the TYPE in the sqlCommand obtained in the previous stage

  • Get the mapping between attribute names and input parameter values in methodSignature

  • Perform SQL query operations and call SqlSession specific methods (Stage 4)

Stage 4 (Caching before query)

  • Get boundSql
  • Generate the cache key required by the primary and secondary caches
  • Start query operation (return cached data with data in cache)
  • Execute the Query method (phase 5)

Stage 5 (db execution)

  • Call Prepareed of StatementHandler for [SQL precompilation]
  • Parameterize from preparedStatementHandler to parameter [SQL] Settings
  • Perform data operations through JDBC
  • Put the queried value in the cache

Stage 6 (POJO conversion for ResultSet)

  • Obtain the ResultSet ResultSet via JDBC and load it into the ResultSetWrapper instance
  • Process the result set to parse the row data