Mastering HttpServletRequest and HttpServletResponse in Java Servlets

Core Mechanisms of Servlet Request and Response Objects In the Java Servlet ecosystem, the container bridges raw HTTP protocol traffic and business logic through two fundamental abstractions: HttpServletRequest and HttpServletResponse. The former encapsulates incoming client data, while the latter orchestrates the server's reply. Understanding ...

Posted on Sun, 24 May 2026 16:50:30 +0000 by telefiend

Implementing Atomic Dish Creation with Flavor Associations in Spring Boot

Creating a dish with associated flavor options requires coordinated writes across two database tables: dish and dish_flavor. To preserve data integrity, these operations must execute as a single atomic unit—either all succeed or none do. This is achieved using Spring’s declarative transaction management. The service layer method responsible for ...

Posted on Wed, 20 May 2026 17:08:36 +0000 by suncore

MyBatis Caching: First-Level, Second-Level, and EHCache Integration

Understanding MyBatis Caching Mechanisms MyBatis incorporates an internal caching system designed to enhance application performance by minimizing redundant database interactions. This caching operates at two distinct levels: a local, session-scoped cache and a global, application-scoped cache. First-Level Cache: SqlSession Scope The first-leve ...

Posted on Wed, 20 May 2026 16:32:32 +0000 by Jackount

Spring Boot Persistence with MyBatis

MyBatis is a lightweight SQL-mapping framweork that removes most JDBC boiler-plate while still giving full control over SQL. The following walkthrough shows how to integrate it into a Spring Boot project and perform common CRUD operations. Project bootstrap and data source configuration Create a new Spring Boot project with the spring-boot- ...

Posted on Wed, 20 May 2026 08:09:11 +0000 by AceE

Using Redis Caching in MyBatis Operations with Spring Boot

In the previous article, we explored Spring Boot integration with Redis. This article focuses on implementing Redis caching in MyBatis operations. We'll examine four key annotations: @CachePut, @Cacheable, @CacheEvict, and @CacheConfig. Fundamentals @Cacheable The @Cacheable annotation configures method-level caching, storing results based on m ...

Posted on Wed, 20 May 2026 07:19:39 +0000 by santhosh_89

Implementing MyBatis XML ResultMap for Entity Associations

Relational database interactions often involve navigating relationships between tables. In MyBatis, the <resultMap> element provides a robust mechanism to map these relationships—One-to-One, One-to-Many, and Many-to-Many—directly to Java object graphs. This process relies heavily on the <association> and <collection> tags wit ...

Posted on Tue, 19 May 2026 05:08:37 +0000 by Bill H

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

Getting Started with MyBatis

<groupId>org.example</groupId> <artifactId>A01mybatis</artifactId> <version>1.0-SNAPSHOT</version> <dependencies> <!-- MyBatis dependency --> <dependency> <groupId>org.mybatis</groupId> <artifactId>mybatis</artifactId> <version>3 ...

Posted on Mon, 18 May 2026 18:14:24 +0000 by CBG

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

Implementing One-to-One Mappings in MyBatis

Database Schema Setup Create tables for identity cards and students, where each student references one card via a foreign key. CREATE TABLE identity_cards ( card_id INT PRIMARY KEY, card_number VARCHAR(20) ); CREATE TABLE students ( student_id INT PRIMARY KEY, student_name VARCHAR(10), card_ref INT, FOREIGN KEY (card_re ...

Posted on Sun, 17 May 2026 20:36:52 +0000 by guru2k9