对了还有一个办法。
在数据操作上:
select columns from sometable where conditions WITH UPDATE
这样也能在数据库上锁住那条记录不被别人修改。