Tag: mybatis
All the articles with the tag "mybatis".
Analyzing the ShardingJDBC Execution Flow
Uses the MyBatis call flow to analyze how ShardingJDBC 4.1.1 integrates with JDBC through custom DataSource, Connection, and PreparedStatement implementations. It traces parameter buffering, physical connection acquisition, and result-set handling, then simulates the proxy workflow with simplified code.
ShardingSphere (Part 4): Custom Encryption Strategies for Data Masking
Using ShardingSphere 4.1.1, this article implements and configures custom encryption strategies and traces SPI-based encryptor registration through the source code. It demonstrates Encryptor and QueryAssistedEncryptor separately, then verifies how an assisted-query column supports queries over differing ciphertext values.
Using ShardingSphere–ShardingJDBC (Part 3): Data Masking
Building on data sharding and read/write splitting, this article uses ShardingJDBC’s built-in algorithms to encrypt stored fields and decrypt query results. It verifies the configuration through inserts and queries and discusses full routing without a sharding key, including the number of tables queried and the maintainers’ explanation.
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.
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 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 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 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.