"> "> ">
<mappers>
<package name="com.haenin.xmlmapper"/>
</mappers>
package 방식 → 해당 패키지 내의 Mapper 인터페이스들을 한 번에 등록<mapper namespace = "com.haenin.xmlmapper.ElementMapper">
⇒ 인터페이스 패키지명과 동일하게 작성
<resultMap id="menuResultMap" type="com.haenin.xmlmapper.MenuDTO">
<id property="menuCode" column="MENU_CODE"/>
<result property="menuName" column="MENU_NAME"/>
<result property="menuPrice" column="MENU_PRICE"/>
<result property="categoryCode" column="CATEGORY_CODE"/>
</resultMap>
resultMap: DB 결과 컬럼을 DTO 필드에 매핑id: PK 지정 (성능 최적화)result: 일반 필드 매핑<!-- menuResultMap을 물려 받아 위의 4가지 속성을 가지고 있음 -->
<resultMap id="menuResultMap2"
**extends**="menuResultMap"
type ="com.haenin.xmlmapper.MenuDTO">
<result property="orderableStatus" column="ORDERABLE_STATUS"/>
</resultMap>
extends → 상속menuResultMap의 매핑에 orderableStatus만 추가<!-- 1. Association 관계에서 resultMap 2개 활용 -->
<resultMap id = "menuAndCategoryResultMap"
type = "com.haenin.xmlmapper.MenuAndCategoryDTO">
<id property = "menuCode" column = "MENU_CODE"/>
<result property = "menuName" column = "MENU_NAME"/>
<result property = "menuPrice" column = "MENU_PRICE"/>
<!-- <result property = "categoryCode" column = "CATEGORY_CODE"/>-->
<result property = "orderableStatus" column = "ORDERABLE_STATUS"/>
<!-- assiciation을 이용해 categoryResultMap을 가져옴 -->
<!-- assiciation은 가장 밑에 단에 붙임 -->
<association property = "category" resultMap = "**categoryResultMap**"/>
</resultMap>
<resultMap id = "**categoryResultMap**" type = "com.haenin.xmlmapper.CategoryDTO">
<id property = "categoryCode" column = "CATEGORY_CODE"/>
<result property = "categoryName" column = "CATEGORY_NAME"/>
<result property = "refCategoryCode" column = "REF_CATEGORY_CODE"/>
</resultMap>
<!-- 2. Association 관계에서 resultMap 1개 활용 -->
<resultMap id = "menuAndCategoryResultMap"
type = "com.haenin.xmlmapper.MenuAndCategoryDTO">
<id property = "menuCode" column = "MENU_CODE"/>
<result property = "menuName" column = "MENU_NAME"/>
<result property = "menuPrice" column = "MENU_PRICE"/>
<result property = "orderableStatus" column = "ORDERABLE_STATUS"/>
<association property = "category"
javaType = "com.haenin.xmlmapper.CategoryDTO">
<id property = "categoryCode" column = "CATEGORY_CODE"/>
<result property = "categoryName" column = "CATEGORY_NAME"/>
<result property = "refCategoryCode" column = "REF_CATEGORY_CODE"/>
</association>
</resultMap>