遇到一个坑,然后....;懒得描述了,看代码吧:
@Before(Tx.class)
public boolean business() {
// do something with your business
Db.update("update table set status = '0' where id = 1");
// another business
anotherBusiness();
}
public void anotherBusiness() {
// do with your new business;
// this business need data with conditions updated in previous business just like (status != '0'),and can we get it ?
Record dbData = Db.findFirst("select * from table where status != '0' and id = 1");
// the answer is that we can`t get it; so how we fix it; change your update order in last business;
}
//fixed
@Before(Tx.class)
public boolean business() {
// do something with your business
// another business
anotherBusiness();
Db.update("update table set status = '0' where id = 1"); // and update last;
}
云教务管理员
用IT武装教育!