0
点赞
收藏
分享

微信扫一扫

Error querying database. Cause: java.lang.UnsupportedOperationException

眼君 2022-03-12 阅读 237

mybatis抛出以下异常:

org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.exceptions.PersistenceException: 
### Error querying database.  Cause: java.lang.UnsupportedOperationException
### The error may exist in com/drs/mapper/AppointmentMapper.xml
### The error may involve com.drs.mapper.AppointmentMapper.appointTime
### The error occurred while handling results
### SQL: select id from tb_time where id not in(select time_id from tb_reservation         where car_id=? and appointmentDate=?);
### Cause: java.lang.UnsupportedOperationException

Error querying database. Cause: java.lang.UnsupportedOperationException

对应语句如下:

<select id="appointTime" resultType="List" parameterType="map">
        select id from tb_time where id not in(select time_id from tb_reservation
        where car_id=#{car_id} and appointmentDate=#{appointmentDate});
    </select>

错误原因是 resultType=“List” ,这里应该改成: resultType=“java.lang.Integer”

<select id="appointTime" resultType="java.lang.Integer" parameterType="map">
        select id from tb_time where id not in(select time_id from tb_reservation
        where car_id=#{car_id} and appointmentDate=#{appointmentDate});
    </select>

这里 resultType 指的是 select 返回的每一条记录 的类型(单个值),而不是所有记录组成的类型。

举报

相关推荐

0 条评论