mysql如何在java中获取更新的行Id
Query branch_update = null;
Branches branchObject = null;
try {
branch_update = this.sessionFactory.getCurrentSession()
.createQuery("Update Branches set branchname =:branchname,update_date =:update_date WHERE branchname =:branchname1");
branch_update.setParameter("branchname", stringCellValue);
branch_update.setParameter("update_date", new Date());
branch_update.setParameter("branchname1", stringCellValue);
int update_id = branch_update.executeUpdate();
} catch (Exception exception) {
logger.error("Exception occured at \t e", exception.getMessage(), exception);
}
使用分支名称更新行时。如何获取更新的行分支id
提前谢谢
# 1 楼答案
您可以使用getGeneratedKeys() method来获取结果集
编辑:- 那样的话,我想这应该会有帮助