3.5.5. Setting the Transaction Isolation
OpenJPA typically retains the default transaction isolation level of the JDBC driver.
However, you can specify a transaction isolation level to use through the openjpa.jdbc.TransactionIsolation configuration property.
The following is a list of standard isolation levels.
Note that not all databases support all isolation levels.
-
default: Use the JDBC driver’s default isolation level. OpenJPA uses this option if you do not explicitly specify any other. -
none: No transaction isolation. -
read-committed: Dirty reads are prevented; non-repeatable reads and phantom reads can occur. -
read-uncommitted: Dirty reads, non-repeatable reads and phantom reads can occur. -
repeatable-read: Dirty reads and non-repeatable reads are prevented; phantom reads can occur. -
serializable: Dirty reads, non-repeatable reads, and phantom reads are prevented. openjpa-project/src/doc/manual/ref_guide_dbsetup.xml
<property name="openjpa.jdbc.TransactionIsolation" value="repeatable-read"/>