开发者

What is an isolated transaction in Java?

开发者 https://www.devze.com 2023-02-22 11:46 出处:网络
I have been asked the flowing question in an interview:开发者_运维百科 \"What does it mean to have an isolated

I have been asked the flowing question in an interview:开发者_运维百科

"What does it mean to have an isolated transaction in Java?"

I can think of the ACID properties and Connection interface static fields, though I am unsure what the correct answer to this question is. Can anyone elaborate an answer?


When transaction is isolated it is meant that no external events can affect result of transaction after it started. It should work as if it is the only transaction ran at a time.


Isolation transaction is all about the data consistency, which is explained nicely at the following link.

http://biese.wordpress.com/2007/11/02/understand-database-isolation-levels/

ie.

Data consistency(Isolation transaction) is a term used to describe the accuracy of data. For example, suppose you have a table that maintains a count of vehicles available for sale in car dealerships. When a vehicle is transferred from dealership A to dealership B, the count has to decrease in dealership A and increase in dealership B. Both actions must take place; if one occurs and another does not, the data becomes inaccurate—data inconsistency occurs

.


Isolation of a transaction is related to compartmentalizing the data affected by the transaction. This can be of various types eg. read_committed. This ensures how other transactions see the data while it is still being modified by a transaction. You can find more details @ http://download.oracle.com/javase/tutorial/jdbc/basics/transactions.html.


I have wrote a transaction isolation example, you can checkout it @ https://github.com/phstudy/Transaction-Isolation-Example

0

精彩评论

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

关注公众号