Caused by: java.lang.UnsupportedOperationException: null 解决办法

是因为xml文件中resultType类型写错导致。
要定义resultMap

  <resultMap id="map" type="com.wf.dao.entity.UserEntity">
        <id column="id" property="id"></id>
        <result column="name" property="name"></result>
    </resultMap>

完整代码如下:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.wf.dao.mapper.UserMapper">

    <resultMap id="map" type="com.wf.dao.entity.UserEntity">
        <id column="id" property="id"></id>
        <result column="name" property="name"></result>
    </resultMap>

    <select id="select" resultType="map">
        select
            id,
            name
        from
            wf
    </select>

</mapper>

猜你喜欢

转载自blog.csdn.net/qq_37950196/article/details/108627860