|
36 | 36 | * Persistence Services (EclipseLink). Developed and tested against EclipseLink 2.7;
|
37 | 37 | * backwards-compatible with EclipseLink 2.5 and 2.6 at runtime.
|
38 | 38 | *
|
39 |
| - * <p>By default, this class acquires an early EclipseLink transaction with an early |
40 |
| - * JDBC Connection for non-read-only transactions. This allows for mixing JDBC and |
41 |
| - * JPA/EclipseLink operations in the same transaction, with cross visibility of |
| 39 | + * <p>By default, this dialect acquires an early EclipseLink transaction with an |
| 40 | + * early JDBC Connection for non-read-only transactions. This allows for mixing |
| 41 | + * JDBC and JPA operations in the same transaction, with cross visibility of |
42 | 42 | * their impact. If this is not needed, set the "lazyDatabaseTransaction" flag to
|
43 | 43 | * {@code true} or consistently declare all affected transactions as read-only.
|
44 | 44 | * As of Spring 4.1.2, this will reliably avoid early JDBC Connection retrieval
|
45 | 45 | * and therefore keep EclipseLink in shared cache mode.
|
46 | 46 | *
|
| 47 | + * <p><b>NOTE: This dialect supports custom isolation levels with limitations.</b> |
| 48 | + * Consistent isolation level handling is only guaranteed when all Spring transaction |
| 49 | + * definitions specify a concrete isolation level, without any default transactions |
| 50 | + * running concurrently. Otherwise, you may see non-default isolation levels exposed |
| 51 | + * to default transactions when custom isolation is used in concurrent transactions. |
| 52 | + * |
47 | 53 | * @author Juergen Hoeller
|
48 | 54 | * @since 2.5.2
|
49 | 55 | * @see #setLazyDatabaseTransaction
|
@@ -85,7 +91,8 @@ public Object beginTransaction(EntityManager entityManager, TransactionDefinitio
|
85 | 91 | // (since Spring 4.1.2 / revised in 5.3.28)
|
86 | 92 | UnitOfWork uow = entityManager.unwrap(UnitOfWork.class);
|
87 | 93 | DatabaseLogin databaseLogin = uow.getLogin();
|
88 |
| - // Synchronize on shared DatabaseLogin instance (-> concurrent transactions) |
| 94 | + // Synchronize on shared DatabaseLogin instance for consistent isolation level |
| 95 | + // set and reset in case of concurrent transactions with different isolation. |
89 | 96 | synchronized (databaseLogin) {
|
90 | 97 | int originalIsolationLevel = databaseLogin.getTransactionIsolation();
|
91 | 98 | // Apply current isolation level value, if necessary.
|
|
0 commit comments