直接上代码吧
先看基础类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.
反复对照,无法确定问题出在何处,纠结中,请各位朋友指点
select属性不是写sql,而是select标签的id