ssm整合意外报空指针

来源:互联网 发布:2016淘宝助理手机版 编辑:程序博客网 时间:2024/06/07 02:38
### Error querying database.  Cause: java.lang.NullPointerException
### The error may exist in file [E:\Myeclipes\apache-tomcat-7.0.62\webapps\message_test\WEB-INF\classes\com\bawei\mapper\TMessageMapper.xml]
### The error may involve com.bawei.mapper.TMessageMapper.getmsg
### The error occurred while handling results
### SQL: select * from t_user u,t_message m where u.uid = m.u_id

### Cause: java.lang.NullPointerException] with root cause



mapper.xml:

<resultMap id="ms" type="com.bawei.pojo.TMessage">
<id column="mid" jdbcType="INTEGER" property="mid" />
<result column="content" jdbcType="VARCHAR" property="content" />
<result column="createtime" jdbcType="TIMESTAMP" property="createtime" />
<result column="u_id" jdbcType="INTEGER" property="uId" />
<association property="tUser" column="t_user">
<id column="uid" jdbcType="INTEGER" property="uid" />
<result column="uname" jdbcType="VARCHAR" property="uname" />
<result column="upass" jdbcType="VARCHAR" property="upass" />
<result column="ugender" jdbcType="VARCHAR" property="ugender" />
</association>
</resultMap>
<select id="getmsg" parameterType="string" resultMap="ms">
select * from t_user u,t_message m where u.uid = m.u_id
<if test="name!=0">
and u.uname=${name}
</if>
</select>






原因不明

-----------------------------------------------


<association property="tUser" column="t_user">  其中column 手残写错了  应该是javaType属性


同类问题 可以查找resultMap   是否一一对应


原创粉丝点击