Relearning MyBatis
Revisit MyBatis through the original five-part series.
5 posts · In reading order
Relearning MyBatis (Part 1)
Starting with traditional JDBC operations and MyBatis XML configuration, this article traces an insert request. Source-level debugging reveals the calls among SqlSession, executors, and StatementHandler, including obtaining a database connection, preparing a statement, and executing SQL.
Relearning MyBatis (Part 2)
Continuing the MyBatis insert flow, this article analyzes PreparedStatement creation and SQL parameter binding. It explains the relationship among BoundSql, parameter mappings, and TypeHandler, showing how values are assigned by type and how these steps correspond to traditional JDBC.
Relearning MyBatis (Part 3)
Source-code debugging traces how MyBatis loads configuration and Mapper XML, and turns SQL statements and their attributes into MappedStatement objects. The article follows placeholder conversion, SqlSource creation, and registration of statement information in the global Configuration.
Relearning MyBatis (Part 4): JDK Dynamic Proxies in Detail
This article revisits the proxy pattern and JDK dynamic-proxy source code to clarify interfaces, implementation classes, proxy classes, and InvocationHandler. Two usage examples explain proxy generation and method invocation, with connections to Spring AOP and MyBatis.
Relearning MyBatis (Part 5)
Analyzes how MyBatis getMapper uses JDK dynamic proxies to create proxy objects for Mapper interfaces. By tracing MapperProxy, MapperMethod, and SqlSession calls, it explains how Mapper methods become SQL operations without requiring handwritten interface implementation classes.