MyBatis SQL Execution Pipeline: From SqlSession to Executor with Caching and Interceptor Support
MyBatis operates as a semi-automated ORM framework, decoupling SQL from Java code via XML or annotations. Its SQL execution follows a delegation chain: SqlSession.getMapper() produces a proxy, MapperProxy intercepts calls, MapperMethod translates them, and Executor handles database interaction, caching, and plugins.
This article dissects the ca ...
Posted on Sun, 07 Jun 2026 17:12:20 +0000 by rmbarnes82
MyBatis Caching: First-Level, Second-Level, and EHCache Integration
Understanding MyBatis Caching Mechanisms
MyBatis incorporates an internal caching system designed to enhance application performance by minimizing redundant database interactions. This caching operates at two distinct levels: a local, session-scoped cache and a global, application-scoped cache.
First-Level Cache: SqlSession Scope
The first-leve ...
Posted on Wed, 20 May 2026 16:32:32 +0000 by Jackount
MyBatis Source Code Analysis: Mapper Proxy Mechanism
In earlier versions of MyBatis, developers could invoke database operations directly through the DefaultSqlSession's selectOne() method using the StatementID defined in Mapper XML files. This approach, while functional, presented significant maintainability challenges. The StatementID was specified as a hardcoded string constant, making refacto ...
Posted on Mon, 18 May 2026 18:03:21 +0000 by bidnshop