Tagged articles
Dynamic SQL
62 articles · Page 1 of 1
This tutorial demonstrates how to configure MyBatis SQL statements using Java annotations instead of XML, covering Maven dependencies, project structure, core configuration files, entity mapping, dynamic SQL providers, mapper interfaces with @Select/@Insert/@Update/@Delete annotations, service layer implementation, and JUnit testing.
AnnotationsDynamic SQLJUnit
0 likes · 17 min read

This tutorial demonstrates how to integrate Spring with MyBatis and JUnit using only annotations, covering Maven dependencies, Druid data source configuration, MyBatis SqlSessionFactory setup, mapper scanning, dynamic SQL with @SelectProvider, service layer wiring, and JUnit test execution with Spring's test context framework.
Annotation ConfigurationDruidDynamic SQL
0 likes · 22 min read

A comprehensive 14k-word technical deep-dive into MyBatis covering its semi-automatic ORM design, four core components (Executor, StatementHandler, ParameterHandler, ResultSetHandler), dynamic SQL parsing via SqlNode trees, two-level caching, plugin mechanism, Spring integration, and source-code-level analysis of 11 key classes with practical best practices and common pitfalls.
CachingDynamic SQLJava Persistence
0 likes · 36 min read

This article dissects MyBatis startup internals, explaining how Mapper interfaces and XML SQL are parsed into MappedStatement objects, the role of SqlSource in static vs dynamic SQL, the #{}/${} difference, and how JDK dynamic proxies enable interface method execution without implementation classes.
ConfigurationDynamic SQLJDK Dynamic Proxy
0 likes · 35 min read

This guide walks through a full MyBatis unit‑testing suite built on Spring Boot 3.x and JDK 17+, showing how to configure Maven dependencies, set up an H2 datasource, write POJOs, define mapper interfaces and XML, and verify features such as mapper proxies, parameter binding, dynamic SQL, resultMap mapping, camel‑case conversion and first‑level caching with JUnit 5.
Dynamic SQLJUnit 5MyBatis
0 likes · 25 min read

This article walks through nine powerful MyBatis dynamic SQL tags—including foreach, if, choose, selectKey, trim, and sql fragments—explaining their attributes, common pitfalls, and providing complete XML and Java examples to help developers write cleaner, error‑free queries and updates.
BackendDynamic SQLJava
0 likes · 17 min read

This article introduces dynamic SQL techniques for Spring Boot 3, compares JPA and MyBatis implementations, and demonstrates how the powerful jpa-search-helper library simplifies complex queries with both map‑based and JSON‑based modes, including pagination and sorting examples.
Dynamic SQLJPAMyBatis
0 likes · 11 min read

This article explains how to configure MyBatis for dynamic SQL using XML mapper files and annotation-based methods, provides step‑by‑step code examples, and compares the advantages and disadvantages of each approach to help developers choose the best solution for their projects.
AnnotationsBackendDynamic SQL
0 likes · 5 min read

This article provides a comprehensive guide to MyBatis dynamic SQL tags—including foreach, if, choose, trim, selectKey, and reusable SQL fragments—explaining their attributes, usage patterns, and code examples to help developers write cleaner, more reliable XML mappers and avoid common pitfalls.
Dynamic SQLJavaMyBatis
0 likes · 19 min read

This article explains how to implement dynamic database switching in MyBatis by intercepting and modifying SQL statements to prepend database names to table names, using JSqlParser and MyBatis interceptors.
Database SwitchingDecorator PatternDynamic SQL
0 likes · 6 min read

This article presents ten practical MyBatis dynamic‑SQL techniques—including foreach, if, choose, selectKey, trim, and sql fragments—explaining their attributes, common pitfalls, and providing complete Java mapper and XML examples that help reduce boilerplate and avoid errors.
Dynamic SQLJavaMyBatis
0 likes · 21 min read

This article provides a comprehensive guide to using MyBatis dynamic SQL tags—including foreach, if, choose, trim, selectKey, and sql fragments—explaining their attributes, usage scenarios, and offering detailed Java and XML code examples to improve query flexibility and reduce errors.
BackendDynamic SQLJava
0 likes · 19 min read

This article provides a comprehensive guide to using MyBatis dynamic SQL tags such as foreach, if, choose, trim, selectKey, and sql fragments, illustrating best practices with detailed code examples for building flexible, error‑free queries and updates in Java backend applications.
BackendDynamic SQLJava
0 likes · 19 min read

This article explains MyBatis dynamic SQL, recounts a first‑hand OOM incident caused by missing backend validation, and shares practical lessons on parameter checking, balancing reusable versus specialized interfaces, and adopting defensive programming to build more reliable backend systems.
Dynamic SQLMyBatisOOM
0 likes · 11 min read

This article explores MyBatis dynamic SQL, shares a real OOM incident caused by missing backend validation, and offers practical tips on parameter checking, balancing reusable and specialized interfaces, and adopting defensive programming to build more reliable Java backend services.
Dynamic SQLJavaMyBatis
0 likes · 12 min read

This article walks through MyBatis dynamic SQL tags—foreach, concat, choose, selectKey, if, where, trim, set, and sql fragments—explaining their attributes, usage patterns, and common pitfalls, and provides complete XML and Java code examples for each technique.
Dynamic SQLJavaMyBatis
0 likes · 20 min read

This article explains how to use MyBatis dynamic SQL tags—including foreach, concat, choose, selectKey, if, where, set, trim, and sql fragments—providing clear examples and tips to write concise, error‑free XML mappings for Java backend applications.
Dynamic SQLJavaMyBatis
0 likes · 17 min read

This article explains how to design a MySQL table for product sales statistics, initialize massive test data, and compare several query strategies—including loop queries, OR‑concatenated dynamic SQL, mixed filtering, and the SQL‑92 row‑comparison technique—to efficiently retrieve sales figures for multiple business units and their products without violating development constraints.
BackendDynamic SQLMySQL
0 likes · 7 min read

MyBatis dynamic SQL lets developers construct conditional queries at runtime using tags like if, where, trim, choose, set, foreach, sql, include, and bind, simplifying complex statements, avoiding manual string concatenation, supporting batch operations, reusable fragments, and one‑to‑many mappings while improving flexibility and maintainability.
Dynamic SQLJavaMyBatis
0 likes · 16 min read

This article provides a comprehensive guide to MyBatis dynamic SQL, covering foreach loops, conditional if, choose, selectKey, trim, and sql fragments, with detailed explanations and full XML and Java code examples to help developers write efficient, error‑free mappings.
Dynamic SQLJavaMyBatis
0 likes · 20 min read

This article explores how to retrieve sales statistics for multiple business units and their associated products in MySQL, compares loop‑based, OR‑concatenated, mixed‑filter, and SQL‑92 row‑comparison techniques, and explains why the row‑comparison method was ultimately chosen for its performance and compliance with development constraints.
Dynamic SQLIndexingMySQL
0 likes · 8 min read

This article provides a comprehensive guide to MyBatis dynamic SQL tags—including foreach, if, choose, trim, and selectKey—showing how to configure XML, handle collections, build flexible queries, and avoid common pitfalls when generating SQL statements.
Dynamic SQLMyBatischoose
0 likes · 18 min read

This article explains MyBatis dynamic SQL, its purpose, and how to use various tags such as if, where, trim, choose, foreach, include, sql, resultMap, association, and collection, providing detailed code examples and best‑practice guidelines for building flexible and secure SQL statements in Java applications.
Dynamic SQLJavaMyBatis
0 likes · 15 min read

This article explains MyBatis dynamic SQL concepts, details the nine dynamic tags (if, where, set, choose, trim, foreach, sql, include, association), provides complete XML mapper examples with code snippets, and demonstrates one‑to‑many, many‑to‑one, and many‑to‑many association queries for Java backend development.
Dynamic SQLJavaMyBatis
0 likes · 16 min read

This article provides a comprehensive guide to MyBatis dynamic SQL tags—including foreach, if, where, choose, trim, set, and selectKey—showing how to build flexible queries, handle collections, and avoid common pitfalls with clear code examples and best‑practice explanations.
Dynamic SQLJavaMyBatis
0 likes · 18 min read

This article provides a comprehensive guide to MyBatis dynamic SQL, explaining its features, common XML tags such as if, where, set, choose, trim, foreach, include, and sql, and demonstrates how to implement CRUD operations, conditional queries, batch processing, and association mappings with clear code examples.
Dynamic SQLJavaMyBatis
0 likes · 17 min read

This article explains MyBatis dynamic SQL, its nine XML tags, execution principle, and how to use if, where, set, choose, trim, foreach, sql, include, and association mappings for flexible query building, batch operations, and one‑to‑many, many‑to‑one, and many‑to‑many relationships.
Dynamic SQLJavaMyBatis
0 likes · 17 min read

This article explains MyBatis dynamic SQL, its powerful XML tags, how to build conditional queries, batch operations, and association mappings, providing clear code examples and best‑practice tips for Java backend developers.
Dynamic SQLJavaMyBatis
0 likes · 16 min read

This article explains how to query sales statistics for multiple business units and their associated products in MySQL by preparing the environment, presenting several candidate solutions—including loop queries, OR concatenation, mixed filtering, and finally row‑comparison—and selecting the row‑comparison approach as the optimal implementation.
Dynamic SQLMySQLRow Comparison
0 likes · 8 min read

This article explains MyBatis dynamic SQL, its execution principle, and the nine core XML tags (if, where, set, choose, trim, foreach, sql, include, resultMap) with detailed examples of CRUD operations, conditional queries, batch processing, and association mappings for Java backend development.
Dynamic SQLJavaMyBatis
0 likes · 15 min read

This tutorial explains how to use MyBatis interceptor mechanisms to dynamically modify SQL statements at runtime in a Spring Boot application, covering interceptor types, implementation steps, configuration, core code, testing, and common use cases such as SQL monitoring, pagination, and data permission filtering.
Dynamic SQLInterceptorJava
0 likes · 11 min read

This article demonstrates how to leverage MyBatis interceptor mechanism in a Spring Boot 3 application to dynamically modify SQL statements, showing step‑by‑step implementation, configuration, core code, testing, and common use cases such as SQL monitoring, pagination, and data permission filtering.
Dynamic SQLInterceptorJava
0 likes · 11 min read

This article explains how to design a MySQL table for product sales statistics, prepares sample data, describes the business requirement of querying sales for multiple business units and their associated products, and evaluates several query strategies—looping, OR concatenation, mixed filtering, and finally row‑row comparison—highlighting why the latter is chosen as the optimal solution.
Dynamic SQLMySQLQuery Design
0 likes · 9 min read

This article provides a comprehensive guide to MyBatis dynamic SQL, demonstrating how to use if, choose, trim, foreach, and bind tags for conditional queries, updates, inserts, batch operations, and database‑agnostic expressions, complete with Maven project setup, SQL scripts, and test cases.
BackendDynamic SQLJava
0 likes · 15 min read

This guide explains how to use MyBatis dynamic SQL tags such as foreach, if, where, choose, trim, and selectKey, providing practical examples for conditional queries, batch inserts, updates, and reusable SQL fragments to write flexible and error‑free MySQL statements in Java applications.
Dynamic SQLJavaMyBatis
0 likes · 17 min read

This article explains why developers often include the redundant condition “WHERE 1=1” in SQL statements, demonstrating through performance tests that it has no effect on execution time, and describing its practical use for simplifying the addition of further conditions in both static and dynamic queries.
Best PracticesDynamic SQLSQL
0 likes · 6 min read

This article provides a comprehensive guide to MyBatis dynamic SQL tags—including foreach, if, choose, trim, selectKey, and related constructs—explaining their attributes, usage scenarios, and offering detailed Java and XML code examples for building flexible and error‑free database queries.
Dynamic SQLJavaMyBatis
0 likes · 16 min read

The article explains how to query sales statistics for multiple business units and their associated products in MySQL, compares several implementation strategies such as looping, OR‑concatenation, mixed filtering, and finally adopts the SQL‑92 row‑by‑row comparison technique to achieve a single‑query solution that respects indexing and corporate coding standards.
Dynamic SQLMySQLRow Comparison
0 likes · 8 min read

This article explains how to use Alibaba's Druid SQL parser to extract and replace dynamic @var parameters in complex SQL statements, detailing the AST structure, visitor pattern, and a complete Java implementation with example code and results.
DruidDynamic SQLJava
0 likes · 13 min read

This comprehensive guide explains what MyBatis is, compares it with Hibernate, details its core components, configuration, dynamic SQL, caching, plugins, pagination, and practical usage patterns, providing Java developers with clear examples, code snippets, and visual diagrams to master the framework efficiently.
Dynamic SQLMyBatisORM
0 likes · 38 min read

This article explains how to use MyBatis dynamic SQL tags—including if, where, set, choose, foreach, sql fragments, and bind—to build flexible queries and updates, with detailed code examples and tips for handling null parameters and avoiding syntax errors.
Dynamic SQLMyBatisSQL
0 likes · 8 min read

This guide demonstrates how to construct flexible MyBatis dynamic SQL statements using tags such as if, where, set, choose, foreach, sql fragments, and bind, showing practical examples for conditional queries, updates, and reusable SQL components to streamline backend data access.
Dynamic SQLJavaMyBatis
0 likes · 8 min read

This article explains how to retrieve sales statistics for multiple business units and their associated products in MySQL by comparing rows, discusses alternative approaches such as loop queries, OR concatenation, and mixed filtering, and demonstrates why row‑by‑row comparison is the most suitable solution.
Dynamic SQLMySQLRow Comparison
0 likes · 8 min read

This article explains how to retrieve sales statistics for multiple business units and their selected products in MySQL, compares loop‑based, OR‑concatenated, mixed‑filter, and SQL‑92 row‑comparison approaches, and shows why the row‑comparison technique was ultimately chosen for its index usage and simplicity.
Database DesignDynamic SQLMySQL
0 likes · 6 min read

This article explains how to design a MySQL table for product sales statistics and compares several query strategies—including loop queries, OR concatenation, mixed filtering, and the SQL‑92 row‑comparison technique—to efficiently retrieve sales data for multiple business units and their associated products in a single indexed query.
Dynamic SQLMyBatisMySQL
0 likes · 7 min read


21CTOMar 9, 2022 · Databases
This article explores how to query sales data for multiple business units and selected products in MySQL, comparing loop queries, OR concatenation, mixed filtering, and SQL‑92 row‑value comparison, ultimately recommending the row‑comparison technique for efficiency and maintainability.
Database DesignDynamic SQLMySQL
0 likes · 8 min read

This article explains MyBatis dynamic SQL, covering its purpose, the distinction between static and dynamic SQL, the core SqlNode and SqlSource classes, how MyBatis parses and assembles SQL scripts recursively, and provides concrete code examples to illustrate each step.
Code ExampleDynamic SQLJava
0 likes · 13 min read

This article demonstrates how MyBatis dynamic SQL simplifies conditional query building by explaining the usage of if, choose, foreach, trim, and bind tags, providing Maven project setup, table creation scripts, mapper interfaces, XML snippets, and unit test examples for SELECT, UPDATE, INSERT, and batch operations.
BackendDynamic SQLJava
0 likes · 19 min read

This article explains how to retrieve sales statistics for multiple business units and their associated products from a MySQL table, compares several implementation approaches—including loop queries, OR concatenation, mixed filtering, and row‑comparison using MyBatis dynamic SQL—evaluates index usage, and provides the final recommended solution.
Dynamic SQLMyBatisMySQL
0 likes · 8 min read

The article describes how to design a MySQL table for product sales statistics, initialize large data sets, and compare several approaches—including loop queries, OR concatenation, mixed filtering, and row‑comparison techniques—ultimately selecting row‑comparison as the most efficient solution within MyBatis dynamic SQL constraints.
Database DesignDynamic SQLMyBatis
0 likes · 6 min read

When using MyBatis dynamic SQL to filter records by a numeric state field, the framework incorrectly evaluates the condition "state != ''" as false for the integer value 0 because its OGNL expression evaluator treats 0 as equivalent to an empty string, leading to unexpected query results.
Dynamic SQLInteger ComparisonJava
0 likes · 7 min read

The article explains that inserting ‘WHERE 1=1’ in dynamically built SQL statements prevents syntax errors when appending additional conditions, illustrates its use with Java string concatenation examples, discusses performance considerations, and shows how to copy tables or duplicate structures using this technique.
Database PerformanceDynamic SQLSQL
0 likes · 3 min read

This article presents nine practical MyBatis techniques—including pagination, preset column selection, one‑to‑many and one‑to‑one associations, foreach‑in queries, dynamic where clauses, choose/otherwise logic, hidden _parameter usage, and dynamic set updates—illustrated with SpringBoot and MySQL code examples.
Dynamic SQLMyBatisMySQL
0 likes · 6 min read

This tutorial explains how to replace verbose MyBatis mapper XML files with the modern Dynamic SQL API, covering setup, Maven dependencies, configuration, code generation, CRUD operations, advanced queries, subqueries, joins, conditional updates, and one‑to‑many mappings for Java backend development.
CRUDDynamic SQLJava
0 likes · 34 min read

This article explains MyBatis dynamic SQL features—including if, choose, trim, foreach, and bind tags—by showing how to set up a Maven project, create a student table, write mapper methods, and run tests that demonstrate conditional queries, updates, inserts, batch operations, and database‑agnostic expressions.
Dynamic SQLMyBatisORM
0 likes · 19 min read

This tutorial demonstrates how to leverage MyBatis dynamic SQL features—including if, choose, trim, foreach, and bind tags—to build flexible SELECT, INSERT, UPDATE, and DELETE statements with conditional logic, code examples, and test cases for Java backend development.
Dynamic SQLMyBatisORM
0 likes · 15 min read

This article explains how MyBatis dynamic SQL tags such as if, choose, trim, foreach, and bind can be used to build flexible SELECT, INSERT, UPDATE, and DELETE statements, showing code examples, test cases, and best‑practice tips for handling optional parameters and batch operations in Java backend development.
BackendDynamic SQLJava
0 likes · 20 min read

This article explains MyBatis dynamic SQL, describing each core XML tag (if, choose/when/otherwise, where, foreach, set, sql, include), showing practical code snippets, and offering advanced tips such as avoiding magic numbers and referencing SQL fragments across mapper files.
Dynamic SQLJavaMyBatis
0 likes · 14 min read

This tutorial explains how to use MyBatis dynamic SQL tags such as if, choose, trim, foreach, and bind to build flexible SELECT, UPDATE, INSERT, and batch statements, demonstrating data preparation, conditional query construction, selective updates, conditional inserts, and advanced tag usage with complete Java test examples.
Dynamic SQLJavaMyBatis
0 likes · 20 min read

This article provides a comprehensive guide to MyBatis dynamic SQL, covering essential tags such as if, choose, trim, foreach, and bind, with practical Maven project setup, full SQL examples, and JUnit tests that demonstrate conditional queries, updates, inserts, and batch operations.
BackendDynamic SQLMyBatis
0 likes · 20 min read

This article explains how to use MyBatis dynamic SQL tags such as if, choose, trim, foreach, and bind, providing detailed examples of conditional queries, updates, inserts, and batch operations with accompanying Java and XML code.
Dynamic SQLMyBatisORM
0 likes · 15 min read

This article provides a thorough overview of MyBatis, covering its core concepts, architecture, Spring integration, configuration elements, SQL mapping techniques, dynamic SQL tags, and practical usage tips such as type aliases, ResultMap, caching, and the differences between #{} and ${} placeholders.
Dynamic SQLJavaMyBatis
0 likes · 7 min read
