MyBatis Mapper Configuration for Elderly Care Assessment System
MyBatis Interface Defniition
The ElderlyMapper interface defines all database operations for the assessment system:
package com.elderly.mapper;
import org.apache.ibatis.annotations.Param;
import com.elderly.entity.*;
import java.util.List;
public interface ElderlyMapper {
int createAccount(@Param("accountId") String accountId, @ ...
Posted on Wed, 22 Jul 2026 16:56:10 +0000 by zuessh
Handling Multiple Parameter Types in MyBatis Mapper Methods
MyBatis supports various ways to pass parameters to mapper methods, depending on the type and number of arguments. Below are common scenarios with corresponding interface definitions, XML mappings, and usage patterns.
Mapper Interface
package com.msb.mapper;
import com.msb.pojo.Emp;
import org.apache.ibatis.annotations.Param;
import java.util. ...
Posted on Mon, 20 Jul 2026 17:37:26 +0000 by bnmng
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
MyBatis Return Types: Handling List, Map, and Fuzzy Queries
Returning List Results
When querying multiple records, MyBatis can automatically map results to a Java List. The mapper XML uses the same select element, but the Java method declares List as the return type.
Mapper Interface:
public interface StudentDao {
List<Student> selectAllStudents();
}
Mapper XML:
<select id="selectAllS ...
Posted on Sat, 09 May 2026 22:54:07 +0000 by ChaosKnight