天冷就回家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 深度学习根据CNN网络模型,搭建BP模型并训练MNIST数据集
  • ¥15 lammps拉伸应力应变曲线分析
  • ¥15 C++ 头文件/宏冲突问题解决
  • ¥15 用comsol模拟大气湍流通过底部加热(温度不同)的腔体
  • ¥50 安卓adb backup备份子用户应用数据失败
  • ¥20 有人能用聚类分析帮我分析一下文本内容嘛
  • ¥15 请问Lammps做复合材料拉伸模拟,应力应变曲线问题
  • ¥30 python代码,帮调试,帮帮忙吧
  • ¥15 #MATLAB仿真#车辆换道路径规划
  • ¥15 java 操作 elasticsearch 8.1 实现 索引的重建