Mybatis annotation method, how to implement MySQL, after update, return the updated value

as shown in the title, the stupidest way is to write a modification statement first, and then write a query statement, but it is a waste of resources to connect to the database frequently

based on Mybatis, can @ Update be implemented, and the return value is the changed target value, or, like @ Insert, add @ option or something, and return the inserted data as an entity class

Apr.10,2022

  1. if you look at the source code of mybatis, you will find that mybatis implements the update operation in this way
  

you just call it in a transaction.
what you are worried about is that two statements use two connections. The statements you execute in a transaction are all under one connection

.
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b33563-2bea1.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b33563-2bea1.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?