Implementing CRUD Operations with MyBatis Annotations
While XML configuration remains the predominant approach in MyBatis, annotation-based development offers a streamlined alternative that is widely adopted across other frameworks in the ecosystem.
Defining Mapper Interfaces with Annotations
Annotate methods directly on the interface to specify SQL queries:
public interface UserDao {
@Se ...
Posted on Wed, 26 Aug 2026 16:12:43 +0000 by brokenshadows
Getting Started with MyBatis: A Practical Guide
The Evolution of Database Access: Introducing MyBatis
In the landscape of database interaction, developers often grapple with the trade-offs between raw JDBC and full-fledged ORM solutions like Hibernate. JDBC, while offering direct control and high performance, demands significant boilerplate code for connection management and manual SQL craft ...
Posted on Tue, 25 Aug 2026 16:48:33 +0000 by judgy
Configuring Multiple Data Sources with MyBatis and Druid in Spring Boot
Database Setup
This example demonstrates a read-write database separation setup. The write database (mybatis1) handles write operations, while the read database (mybatis) handles read operations. Both databases share identical table structures.
Write Database Schema
CREATE DATABASE `mybatis1` DEFAULT CHARACTER SET utf8;
CREATE TABLE `user` (
...
Posted on Tue, 25 Aug 2026 16:15:35 +0000 by roswell
Building a Java Web Application with MyBatis Configuration
Environment Configuration
This project requires several configuration files to be placed in the resources directory.
logback.xml Configuration
Create a logback configuration file for logging output:
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<appender name="Console" class="ch.qos ...
Posted on Thu, 20 Aug 2026 16:50:41 +0000 by joseph
Resolving Common Issues in Spring Boot and MyBatis Integration
Integration Steps
To integrate MyBatis with a Spring Boot project, start by adding necessary dependencies to your pom.xml:
<dependencies>
<!-- MySQL Driver -->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>8.0.33</ve ...
Posted on Thu, 20 Aug 2026 16:39:17 +0000 by temidayo
Understanding MyBatis Caching Mechanisms and Spring Integration
MyBatis Caching Architecture
MyBatis provides a multi-level caching system to optimize database query performance. The first-level cache operates at the SqlSession scope, meaning it is thread-local and isolated per session. When the same query is executed multiple times within a single session, the database is bypassed after the initial hit.
@T ...
Posted on Wed, 19 Aug 2026 16:18:15 +0000 by abhishekphp6
Eliminating DAO Implementation Classes with MyBatis-Spring MapperScannerConfigurer
MyBatis-Spring provides a powerful feature that eliminates the need for manual DAO implementation classes. Instead of creating concrete implementations, the framework can automatically convert mapper intefraces into Spring beans through MapperFactoryBean.
When working with individual mapper interfaces, the traditional approach requires explicit ...
Posted on Wed, 19 Aug 2026 16:06:33 +0000 by stilgar
MyBatis Annotation-Based Persistence: From Basic CRUD to Complex Mappings
Core Annotation-Driven Operations
Essential MyBatis Annotations
Modern Java development favors annotation-based configuration over XML. MyBatis provides a comprehensive set of annotations that eliminate the need for XML mapper files while maintaining full functionality.
Key annotations include:
@Select: Executes query statements
@Insert: Handl ...
Posted on Sun, 16 Aug 2026 16:15:25 +0000 by xengvang
Cloud-Native Hotel Management Platform with SSM Stack
This article walks through the architecture, key modules, and representative code snippets of a production-grade hotel management system built with Spring, Spring MVC, and MyBatis (SSM). The project, internally named SeaWave Cloud, is tailored for mid-scale hotel chains that need both front-desk agility and back-office control.
System Overview ...
Posted on Thu, 13 Aug 2026 16:33:46 +0000 by Jeyush
MyBatis Framework: Quick Start Guide with Core Concepts
MyBatis Overview
1.1 Framework Introduction
1.2 JDBC Limitations
1.3 MyBatis Improvements
Quick Start Tutorial
Mapper Proxy Development
3.1 Proxy Pattern Overview
3.2 Implementation Requirements
3.3 Practical Implementation
Core Configuration File
4.1 Multi-Environment Setup
4.2 Type Aliases
XML-Based CRUD Operations
...
Posted on Tue, 11 Aug 2026 16:11:50 +0000 by bijukon