问答详情
源自:8-4 整合MyBatis - 自定义mapper的实现

参数空指针,根据debug一步一步走,并没有发现参数空指针!

------------------------------这是异常信息------------------------------

java.lang.NullPointerException

at com.imooc.service.impl.UserServiceImpl.queryUserSimplyInfoById(UserServiceImpl.java:118)

at com.imooc.controller.MyBatisCRUDController.queryUserByIdCustom(MyBatisCRUDController.java:110)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

------------------------------这是xml配置------------------------------

<mapper namespace="com.imooc.mapper.SysUserMapperCustom" >

<!-- resultType就是不需要配置restmap对应属性参数,但是需要字段与数据库字段保持一致  parameterType为传入参数类型-->

<select id="queryUserSimplyInfoById" resultType="com.imooc.pojo.SysUser" 

parameterType="java.lang.String" >

select * from sys_user where id = #{id,jdbcType=VARCHAR}

</select>

<sql id="columns">id,username</sql>

</mapper>

at java.lang.reflect.Method.invoke(Method.java:498)


提问者:qq_生活终病态_0 2020-02-17 19:06

个回答

  • 慕哥6337308
    2020-03-28 20:47:09

    UserServiceImpl.java:118 行空指针