Skip to content

Commit 2b96a61

Browse files
committed
Apply transactionIsolationLock in EclipseLinkConnectionHandle as well
Closes gh-36165
1 parent c55351a commit 2b96a61

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

spring-orm/src/main/java/org/springframework/orm/jpa/vendor/EclipseLinkJpaDialect.java

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ public ConnectionHandle getJdbcConnection(EntityManager entityManager, boolean r
171171
* This is useful to defer the early transaction begin that obtaining a
172172
* JDBC Connection implies within an EclipseLink EntityManager.
173173
*/
174-
private static class EclipseLinkConnectionHandle implements ConnectionHandle {
174+
private class EclipseLinkConnectionHandle implements ConnectionHandle {
175175

176176
private final EntityManager entityManager;
177177

@@ -184,7 +184,13 @@ public EclipseLinkConnectionHandle(EntityManager entityManager) {
184184
@Override
185185
public Connection getConnection() {
186186
if (this.connection == null) {
187-
this.connection = this.entityManager.unwrap(Connection.class);
187+
transactionIsolationLock.lock();
188+
try {
189+
this.connection = this.entityManager.unwrap(Connection.class);
190+
}
191+
finally {
192+
transactionIsolationLock.unlock();
193+
}
188194
}
189195
return this.connection;
190196
}

0 commit comments

Comments
 (0)