Dynamic SQL Date and Loop Queries

Dynamic SQL for Date Range and List Queries When building dynamic queries in MyBatis, it's common to filter by date ranges and iterate over a list of values. Below is an example showing how to handle both scenarios using MyBatis dynamic SQL with where, if, and foreach tags. SQL Mapping <select id="selectQuotaManagement" resultType= ...

Posted on Wed, 09 Sep 2026 16:57:14 +0000 by theDog

MyBatis Reverse Engineering with Generator Plugin

Forward Engineering First, create Java entity classes, then the framework generates database tables based on them. Hibernate supports forward engineering. Reverse Engineering First, create the database tables, then the framework generates the folloiwng resources from them: Java entity clases Mapper interfaces Mapper XML mapping files Steps to ...

Posted on Mon, 07 Sep 2026 16:47:24 +0000 by FunkyELF

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