使用getGeneratedKeys-MyBatis时获取更新记录主键失败。

问题描述 投票:0回答:1
我正在MyBatis(v3.5.1)中使用这种方式尝试获取更新记录主键:

<update id="updateForFreeSeat" parameterType="com.sportswin.soa.room.model.entity.RoomSeat" useGeneratedKeys="true" keyProperty="id" keyColumn="id"> update r_room_seat set status = 1 where room_play_id = #{roomPlayId,jdbcType=BIGINT} limit 1 </update>

和Mapper.java定义如下:

int updateForFreeSeat(RoomSeat roomSeat);

现在我得到更新记录ID失败,该ID是我的主要键。这是我的调试输出:

enter image description here

我应该怎么做以获得更新记录的ID?

我正在尝试在MyBatis(v3.5.1)中使用这种方式获取更新记录主键:

java mybatis
1个回答
0
投票
我这样实现:
© www.soinside.com 2019 - 2024. All rights reserved.