JDBC Connection[HikariProxyConnection@421632334 wrapping com.mysql.cj.jdbc.ConnectionImpl@43c87306] will not be managed by Spring==>Preparing:SELECT id,name,price,version FROM t_product WHERE id=?==>Parameters:1(Integer)<==Columns: id, name, price, version
<==Row:1, 外星人筆記本,100,0<==Total:1Closing non transactional SqlSession[org.apache.ibatis.session.defaults.DefaultSqlSession@4487c0c2]
小李獲取的商品價格為:100Creating a newSqlSessionSqlSession[org.apache.ibatis.session.defaults.DefaultSqlSession@3b705be7] was not registered for synchronization because synchronization is not active
JDBC Connection[HikariProxyConnection@981012032 wrapping com.mysql.cj.jdbc.ConnectionImpl@43c87306] will not be managed by Spring==>Preparing:SELECT id,name,price,version FROM t_product WHERE id=?==>Parameters:1(Integer)<==Columns: id, name, price, version
<==Row:1, 外星人筆記本,100,0<==Total:1Closing non transactional SqlSession[org.apache.ibatis.session.defaults.DefaultSqlSession@3b705be7]
小王獲取的商品價格為:100Creating a newSqlSessionSqlSession[org.apache.ibatis.session.defaults.DefaultSqlSession@63d5874f] was not registered for synchronization because synchronization is not active
JDBC Connection[HikariProxyConnection@796851467 wrapping com.mysql.cj.jdbc.ConnectionImpl@43c87306] will not be managed by Spring==>Preparing: UPDATE t_product SET name=?, price=?, version=?WHERE id=?==>Parameters: 外星人筆記本(String),150(Integer),0(Integer),1(Long)<==Updates:1Closing non transactional SqlSession[org.apache.ibatis.session.defaults.DefaultSqlSession@63d5874f]Creating a newSqlSessionSqlSession[org.apache.ibatis.session.defaults.DefaultSqlSession@8cc8cdb] was not registered for synchronization because synchronization is not active
JDBC Connection[HikariProxyConnection@505635448 wrapping com.mysql.cj.jdbc.ConnectionImpl@43c87306] will not be managed by Spring==>Preparing: UPDATE t_product SET name=?, price=?, version=?WHERE id=?==>Parameters: 外星人筆記本(String),70(Integer),0(Integer),1(Long)<==Updates:1Closing non transactional SqlSession[org.apache.ibatis.session.defaults.DefaultSqlSession@8cc8cdb]Creating a newSqlSessionSqlSession[org.apache.ibatis.session.defaults.DefaultSqlSession@1fc713c9] was not registered for synchronization because synchronization is not active
JDBC Connection[HikariProxyConnection@1929506494 wrapping com.mysql.cj.jdbc.ConnectionImpl@43c87306] will not be managed by Spring==>Preparing:SELECT id,name,price,version FROM t_product WHERE id=?==>Parameters:1(Integer)<==Columns: id, name, price, version
<==Row:1, 外星人筆記本,70,0<==Total:1Closing non transactional SqlSession[org.apache.ibatis.session.defaults.DefaultSqlSession@1fc713c9]
老板獲取的商品價格為:70
小李查詢商品信息:? SELECT id,name,price,version FROM t_product WHERE id=?小王查詢商品信息:? SELECT id,name,price,version FROM t_product WHERE id=?小李修改商品價格,自動將version+1? UPDATE t_product SET name=?, price=?, version=?WHERE id=?AND version=?? Parameters: 外星人筆記本(String),150(Integer),1(Integer),1(Long),0(Integer)小王修改商品價格,此時version已更新,條件不成立,修改失敗? UPDATE t_product SET name=?, price=?, version=?WHERE id=?AND version=?? Parameters: 外星人筆記本(String),70(Integer),1(Integer),1(Long),0(Integer)最終,小王修改失敗,查詢價格:150? SELECT id,name,price,version FROM t_product WHERE id=?