Transaction isolation level

ISOLATION_DEFAULT

This is a PlatfromTransactionManager default isolation level, using the database to the default transaction isolation level.

ISOLATION_READ_UNCOMMITTED

This is the lowest isolation level for a transaction and allows an outside transaction to see the uncommitted data of that transaction. This isolation level produces dirty reads, non-repeatable reads, and phantom reads.

ISOLATION_READ_COMMITTED

Ensure that data modified by one transaction is committed before it can be read by another transaction. Another transaction cannot read uncommitted data from that transaction.

ISOLATION_REPEATABLE_READ

This transaction isolation level prevents dirty, non-repeatable reads. But illusionary reading can occur. In addition to ensuring that one transaction cannot read uncommitted data from another transaction, it also ensures that unrepeatable reads are avoided.

ISOLATION_SERIALIZABLE

This is the most expensive but reliable transaction isolation level. Transactions are processed for sequential execution. In addition to preventing dirty read, not repeat read, but also avoid phantom read.

What are dirty data, dirty reads, unrepeatable reads, and phantom reads?

Dirty read

If a transaction changes a row but does not commit it, the second transaction can read the row. If the first transaction rolls back, the second transaction will get a dirty read. Help your memory: write and read

Unrepeatable read

One transaction reads a row of data, the second transaction modifies the row, and the first transaction rereads the forensics row to a different value. Therefore it is called unrepeatable read. Help memory: read, write, read

Phantom read

A transaction reads all the data that meets a WHERE condition, a second transaction inserts a row that also meets the WHERE condition, and the first transaction retrieves the extra row with the WHERE condition. Help remember: where insert where