天冷就回家0202 2014-08-29 15:03 采纳率: 0%
浏览 1889

急急急!!!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条回答

  • 普通网友 2016-07-12 01:11
    关注

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

    评论

报告相同问题?

悬赏问题

  • ¥15 我这模型写的不对吗?为什么lingo解出来的下面影子价格这一溜少一个变量
  • ¥50 树莓派安卓APK系统签名
  • ¥15 maple软件,用solve求反函数出现rootof,怎么办?
  • ¥65 汇编语言除法溢出问题
  • ¥15 Visual Studio问题
  • ¥20 求一个html代码,有偿
  • ¥100 关于使用MATLAB中copularnd函数的问题
  • ¥20 在虚拟机的pycharm上
  • ¥15 jupyterthemes 设置完毕后没有效果
  • ¥15 matlab图像高斯低通滤波