---
title: "IBatis SqlMap的namespace"
author: "xinglongbing"
date: "2010-01-06T22:33:18Z"
tags: ["iBATIS"]
categories: ["企业架构"]
slug: "ibatis-sqlmap-namespace"
draft: false
lastmod: "2010-01-06T22:33:18Z"
id: 564321
url: "https://xinglongbing.iteye.com/blog/564321"
---

今天碰到以下错误：针对1：N的关系用groupBy属性避免N+1查询问题，但是在resultMap 中的&lt;result property="" resultMap=B&gt;去引用时始终报错说，在resultMap A中设置property出错，找不到named为B的resultMap。最后发现是由于在改SqlMap属性中加了namespace，因此，在resultMap中引用其他resultMap时必须要添加包含命名空间的名字也就是namespace.B，如果SqlMap没有指定namespace属性那么可以直接使用resultMap定义的名字。