Resultmap Articles
2 articles about Resultmap. Explore Spring Boot implementation, design, and operations across related topics.
-
Spring Boot + MyBatis Polymorphic Mapping with discriminator - resultMap Implementation to Branch a Single Table by Type
This article explains how to use MyBatis's discriminator tag and case elements to map multiple types (such as notification types or payment methods) mixed within a single table or JOIN result to different DTOs/subclasses using only resultMap, without any branching logic on the Java side.
-
How to Map One-to-Many and Many-to-One Join Results with Spring Boot + MyBatis - resultMap association/collection and N+1 Countermeasures
Explains how to load parent-child table JOIN results into hierarchical DTOs with Spring Boot 3 + MyBatis. Covers resultMap association (many-to-one) and collection (one-to-many), avoiding column collisions with columnPrefix, a comparison of the number of SQL statements issued by nested select vs. nested resultMap (measured N+1), and the pitfall of mismatched row counts when combined with paging along with workarounds, with copy-paste-ready code in both XML and annotation styles.