首页 新闻 会员 周边

IBatisNet 一对一关联查询问题,求指教!

0
悬赏园豆:10 [待解决问题]
  <resultMap id="UserWithDept" class="TUser">
      <result property="UID" column="U_ID" dbType="Int"/>
      <result property="UName" column="U_Name" dbType="VarChar"/>
      <association property="Dept" class="Dept">        
        <id property="DID" column="DID"/>
        <result property="Dept_Name" column="Dept_Name"/>
      </association>
    </resultMap>
  </resultMaps>
 
<!-- 查询带功能的用户-->
    <select id="FindUserWithDeptByID" resultMap="UserWithDept"><!---->
      SELECT U_ID,U_Name,T_USER.DID DID,Detp_NAME
      FROM   T_USER,T_DEPT
      WHERE
      T_USER.DID=T_DEPT.DID AND
      (U_ID=#UID#)
    </select>
 
这样写完,返回的user 对象为什么DEPT属性为空啊?
不钓鱼的猫的主页 不钓鱼的猫 | 初学一级 | 园豆:192
提问于:2015-02-03 15:59
< >
分享
所有回答(1)
0

你的sql语句查询了这个字段么?你把resultMap搞这么麻烦干嘛?

幻天芒 | 园豆:37175 (高人七级) | 2015-02-04 09:04
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册