MyBatis Development: XML vs Annotations and Underlying Implementation

MyBatis supports two development approaches: XML-based and annotation-based. The annotation approach further splits into two variants, resulting in three distinct writing styles. Three Implementation Approaches 1. XML-Based Approach Define the mapper interface: public interface UserMapper { Integer queryAgeByName(String name); } Correspond ...

Posted on Sun, 06 Sep 2026 16:12:39 +0000 by nadeauz

Building RESTful CRUD Services with Spring Boot and MyBatis

Environment Setup Database Schema Create a MySQL database named springboot and a table t_user to hold user records. CREATE DATABASE `springboot`; USE `springboot`; DROP TABLE IF EXISTS `t_user`; CREATE TABLE `t_user` ( `id` INT(11) NOT NULL AUTO_INCREMENT COMMENT 'Primary Key', `name` VARCHAR(10) DEFAULT NULL COMMENT 'User name', `age` ...

Posted on Fri, 04 Sep 2026 16:48:03 +0000 by krishnam1981

Implementing One-to-One Mappings in MyBatis

In MyBatis, handling relationships between tables is a common requirement. A one-to-one relationship occurs when one record in a table is associated with exactly one record in another table. For example, every resident has exact one unique identification card. This guide demonstrates how to implement this using two different strategies: Nested ...

Posted on Fri, 04 Sep 2026 16:29:48 +0000 by jminscoe

Turn MyBatis Log Lines into Runnable SQL with a Single-Page Web Tool

What the tool does Paste raw MyBatis log fragments that contain both the Preparing: line and the Parameters: line, and the page will stitch the placeholders and values together into a ready-to-run SQL statement. The tool is a single HTML file that works entirely in the browser—no server, no installlation. Quick start Copy the HTML source below ...

Posted on Fri, 04 Sep 2026 16:26:41 +0000 by Carlo Gambino

Spring MVC and SSM Integration Guide with Modern Best Practices

Spring MVC Fundamentals To build a Spring MVC application, start by declaring the required dependencies in your pom.xml: <dependencies> <dependency> <groupId>javax.servlet</groupId> <artifactId>javax.servlet-api</artifactId> <version>4.0.1</version> <scope&gt ...

Posted on Tue, 01 Sep 2026 16:56:01 +0000 by mtb211

MyBatis Multi-Table Association Queries

Database Schema Company Table Game Table Game-Company Relationship Table Login Table User Information Table Project Structure One-to-One Relationship Queries Retrieving User by User Information QQ 1. Entity Definition (User class with embedded User Information object) package entity; import java.util.List; public class User extends Base { ...

Posted on Tue, 01 Sep 2026 16:35:34 +0000 by ratebuster

Spring Framework Integration with MyBatis: Core Implementation Mechanisms

Circular Dependency Resolution in Spring Understanding Circular Dependencies Circular dependencies occur when two or more beans depend on each other, creating a dependency cycle. Spring handles this through a three-level caching mechanism. Early AOP and Caching Mechanism The earlySingletonObjects cache (second-level) stores partially constructe ...

Posted on Mon, 31 Aug 2026 16:19:47 +0000 by kiwiwilliam

Setting up a Spring Boot Application with MySQL and Redis Using Docker

Project Structure ├── src | ├── main | | ├── java | | | └── com.example.demo | | | ├── config | | | | └── RedisConfiguration.java | | | ├── controller | | | | └── UserController.java | | | ├── entity | | | | └── User.java | | | ├── repository | | | ...

Posted on Sun, 30 Aug 2026 16:35:06 +0000 by cookspyder

Pagination Strategies in MyBatis: LIMIT Queries, RowBounds, and Plugin Integration

Implementing pagination in MyBatis can be achieved through native SQL clauses, framework-level boundary objects, or dedicated third-party extensions. The following sections outline the implementation details for each approach. Native LIMIT Clause Implementation Utilizing the database-native LIMIT directive provides precise control over result s ...

Posted on Wed, 26 Aug 2026 16:46:19 +0000 by west4me

MyBatis Lazy Loading Implementation Guide

Lazy loading is a performance optimization technique used in MyBatis for handling one-to-many or many-to-many relationships during database queries. Consider a scenario with employee and department tables. A typical LEFT JOIN operation would fetch all related data in a single query. However, when department information is rarely accessed, lazy ...

Posted on Wed, 26 Aug 2026 16:30:34 +0000 by rubenc