mirror of
https://github.com/spring-projects/spring-framework.git
synced 2026-09-17 16:39:29 +00:00
Apply transactionIsolationLock in EclipseLinkConnectionHandle as well
Closes gh-36165
This commit is contained in:
+8
-2
@@ -171,7 +171,7 @@ public class EclipseLinkJpaDialect extends DefaultJpaDialect {
|
||||
* This is useful to defer the early transaction begin that obtaining a
|
||||
* JDBC Connection implies within an EclipseLink EntityManager.
|
||||
*/
|
||||
private static class EclipseLinkConnectionHandle implements ConnectionHandle {
|
||||
private class EclipseLinkConnectionHandle implements ConnectionHandle {
|
||||
|
||||
private final EntityManager entityManager;
|
||||
|
||||
@@ -184,7 +184,13 @@ public class EclipseLinkJpaDialect extends DefaultJpaDialect {
|
||||
@Override
|
||||
public Connection getConnection() {
|
||||
if (this.connection == null) {
|
||||
this.connection = this.entityManager.unwrap(Connection.class);
|
||||
transactionIsolationLock.lock();
|
||||
try {
|
||||
this.connection = this.entityManager.unwrap(Connection.class);
|
||||
}
|
||||
finally {
|
||||
transactionIsolationLock.unlock();
|
||||
}
|
||||
}
|
||||
return this.connection;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user