2 mlc0202 mlc0202 于 2014.08.29 23:03 提问

急急急!!!ibatis一对多映射查询操作 千回百转仍无法定位异常

直接上代码吧
先看基础类public class MetaInfo extends BaseObject{
private String id ; //索引
private String ename ; //字段名称
private String type ; //字段类型
private String length ; //字段长度
private String cname ; //中文名称
private String iskey ; //是否主键
private String originalName ; //元数据名称
private String remark ; //备注
private String tableinfoId ; //关联表信息编号
private String systeminfoid ; //关联系统编号
private List<Department> departList = new ArrayList<Department>(); //组织机构列表
getter,setter方法

再看ibatis配置

<typeAlias alias="metaInfo"    type="app.catalog.catalogservices.metaservices.dao.domain.MetaInfo" />
<typeAlias alias="deptInfo" type="app.admin.department.info.domain.Department" />
<select id="getDepatInfo" parameterClass="java.lang.String" resultClass="deptInfo" >
 select id,shortname,name_en from sys_department 
</select>
<resultMap id="getScope" class="metaInfo">
    <result property="id" column="id"></result>
    <result property="tableinfoId" column="tableinfoId"></result>
    <result property="departList" column="id" select="app.catalog.catalogservices.metaservices.dao.domain.MetaInfo.getDepatInfo"></result>
</resultMap>
<select id="queryForPageElements"  parameterClass="metaInfoPageQueryObject" resultMap="getScope" >
select id,tableinfoid from tacc_pubfieldinfo t where t.IFUSE = 'y'      </select>

异常信息:

--- The error occurred in app/catalog/catalogservices/metaservices/dao/biz/MetaInfo.xml.  

--- The error occurred while applying a result map.

--- Check the app.catalog.catalogservices.metaservices.dao.domain.MetaInfo.getScope.

--- Check the result mapping for the 'departList' property.

--- Cause: java.lang.NullPointerException; nested exception is com.ibatis.common.jdbc.exception.NestedSQLException:

--- The error occurred in app/catalog/catalogservices/metaservices/dao/biz/MetaInfo.xml.

--- The error occurred while applying a result map.

--- Check the app.catalog.catalogservices.metaservices.dao.domain.MetaInfo.getScope.

--- Check the result mapping for the 'departList' property.
反复对照,无法确定问题出在何处,纠结中,请各位朋友指点

1个回答

leilei6939
leilei6939   2016.07.12 09:11

select属性不是写sql,而是select标签的id

Csdn user default icon
上传中...
上传图片
插入图片
准确详细的回答,更有利于被提问者采纳,从而获得C币。复制、灌水、广告等回答会被删除,是时候展现真正的技术了!