开发者

Concurency problem with Isolation - read-committed

I have to write a开发者_Python百科 simple demo for amount withdrawl from a joint Bank amount .Andy and Jen holds a joint bank account with number 123 . Suppose they have 100$ in their account .Jen and Andy are operating their account at the same time and both are trying to withdraw 90$ at the time being .My transaction Isolation is set to read-committed and both are able to withdraw money leaving the balance to -(minus)80$ although I have constraint that balance should never be less than 0.

I am using hibernate .Is versioning only way to solve this problem or I should go for another Isolation level ?


I'm tempted to say that optimistic locking is indeed the way to go (and this is what I would do instead of changing the isolation level, concurrent accesses on the same record sounds like an exceptional situtation).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜