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.