MyBatis Essential Patterns and Best Practices
Insert Operations
Retrieving Auto-Generated Primary Keys
<insert id="saveCustomer" useGeneratedKeys="true" keyProperty="customerId"
parameterType="com.example.domain.Customer">
INSERT INTO customer(name, points, created_at)
VALUES (#{name}, #{points}, #{createdAt})
</insert>
Batch ...
Posted on Mon, 21 Sep 2026 16:18:09 +0000 by desmortes
Implementing CRUD Operations with MyBatis XML Mappers
Implementing data persistence logic requires a clear mapping between Java objects and database tables. The following demonstration outlines the configuration and execution of Create, Read, Update, and Delete (CRUD) operations using MyBatis.
Entity Class Definition
First, define a Plain Old Java Object (POJO) to represent the data structure. T ...
Posted on Fri, 18 Sep 2026 16:28:18 +0000 by sungpeng
Understanding Cookie and Session for Web Authentication with Login/Registration Example
Introduction to Session Tracking
HTTP is a stateless protocol—each request from a client to a server is treated independently. To maintain user context across multiple requests (e.g., keeping a user logged in), web applications use session tracking.
A session begins when a user opens a browser and accesses a web application and ends when the ...
Posted on Thu, 17 Sep 2026 16:44:11 +0000 by micksworld
Implementing a Role-Based Attendance System with Java Web and MyBatis
A role-based employee attendance management system was implemented using Java Servlets, MyBatis, and MySQL. The system supports login, personal information management, password updates, and attendance tracking with differentiated views for employees, department managers, and administrators.
The data model consists of two primary entities:
Staf ...
Posted on Thu, 17 Sep 2026 16:28:35 +0000 by matifibrahim
Implementing CRUD Operations with MyBatis
Building upon foundational MyBatis knowledge, this guide demonstrates how to implement Create, Read, Update, and Delete (CRUD) operations using MyBatis with a clean and maintainable structure.
The implementation requires updates to three core components: the DAO enterface, its corresponding XML mapper, and test cases. All CRUD methods are conso ...
Posted on Mon, 14 Sep 2026 16:28:30 +0000 by andycole
MyBatis CRUD Operations Implementation Guide
Database Setup and Configuration
This guide demonstrtaes how to implement basic CRUD operations using MyBatis. We'll use a student management system as our example.
Database Initialization
CREATE DATABASE `test` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
CREATE TABLE `student` (
`id` INT NOT NULL AUTO_INCREMENT,
`name` VARCHAR ...
Posted on Mon, 14 Sep 2026 16:05:00 +0000 by patmcv
Resolving Spring Transaction Rollback Failures Caused by MySQL MyISAM Storage Engine
During a Java-based system refactoring project—intended to replace an aging PHP application while reusing its existing MySQL database—developers observed inconsistent transaction behavior. Despite correctly applying @Transactional on service methods and deliberately triggering unchecked exceptions (e.g., int result = 1 / 0;), database changes p ...
Posted on Sun, 13 Sep 2026 16:05:31 +0000 by southofsomewhere
SpringBoot Vue.js Uniapp Resource Sharing Platform Development Guide
Detailed Video Demonstration
Contact the author for access to more detailed demonstration videos.
Specific Implementation Screenshots
Included in the documentation.
Technology Stack
Backend Framework: SpringBoot
Spring Boot, built on the Spring Framework, offers several advantages. It includes embedded servers like Tomcat, Jetty, and Undertow, ...
Posted on Sat, 12 Sep 2026 16:22:04 +0000 by prosolutions
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