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

MyBatis ORM Framework Implementation

MyBatis Core Concepts MyBatis is a Java persistence framework that simplifies database interactions through SQL mapping. As a semi-automated ORM tool, it bridges Java objects and relasional databases by mapping: Objects: Java application entities Relations: Database table structures Mappping: Bidirectional conversion between records and object ...

Posted on Sun, 09 Aug 2026 16:38:31 +0000 by carsonk

MyBatis Parameter Handling Techniques

Passing Parameters in MyBatis MyBatis provides multiple ways to pass parameters from Java code to XML mapper files. This article explores several common techniques used in parameter handling. Single Simple Parameter When a DAO interface method has a single simple paraemter (such as a primitive type or String), you can use any placeholder name i ...

Posted on Mon, 18 May 2026 22:51:41 +0000 by Hatch