diff --git a/hawkbit-repository/hawkbit-repository-jpa-eclipselink/src/main/java/org/eclipse/hawkbit/repository/jpa/HawkbitEclipseLinkJpaDialect.java b/hawkbit-repository/hawkbit-repository-jpa-eclipselink/src/main/java/org/eclipse/hawkbit/repository/jpa/HawkbitEclipseLinkJpaDialect.java index 845a37d70..6a4fdb43c 100644 --- a/hawkbit-repository/hawkbit-repository-jpa-eclipselink/src/main/java/org/eclipse/hawkbit/repository/jpa/HawkbitEclipseLinkJpaDialect.java +++ b/hawkbit-repository/hawkbit-repository-jpa-eclipselink/src/main/java/org/eclipse/hawkbit/repository/jpa/HawkbitEclipseLinkJpaDialect.java @@ -10,18 +10,12 @@ package org.eclipse.hawkbit.repository.jpa; import java.io.Serial; -import java.lang.reflect.Field; -import java.sql.Connection; import java.sql.SQLException; -import java.util.concurrent.locks.ReentrantLock; -import jakarta.persistence.EntityManager; import jakarta.persistence.PersistenceException; -import lombok.extern.slf4j.Slf4j; import org.eclipse.hawkbit.repository.jpa.utils.JpaExceptionTranslator; import org.springframework.dao.DataAccessException; -import org.springframework.jdbc.datasource.ConnectionHandle; import org.springframework.jdbc.support.SQLStateSQLExceptionTranslator; import org.springframework.lang.NonNull; import org.springframework.orm.jpa.JpaSystemException; @@ -46,39 +40,11 @@ import org.springframework.orm.jpa.vendor.EclipseLinkJpaDialect; * * */ -@Slf4j class HawkbitEclipseLinkJpaDialect extends EclipseLinkJpaDialect { @Serial private static final long serialVersionUID = 1L; - // TODO: switch to Spring fix - temporarily workaround of https://github.com/eclipse-hawkbit/hawkbit/issues/2876 - // (https://github.com/spring-projects/spring-framework/issues/36165) - private final ReentrantLock supperTransactionIsolationLock; - @SuppressWarnings("java:S3011") // temporarily - to workaround bug in supper class - HawkbitEclipseLinkJpaDialect() { - try { - final Field field = EclipseLinkJpaDialect.class.getDeclaredField("transactionIsolationLock"); - field.setAccessible(true); - supperTransactionIsolationLock = (ReentrantLock) field.get(this); - } catch (final NoSuchFieldException | IllegalAccessException e) { - log.error(e.getMessage(), e); - throw new IllegalStateException("Cannot access supper class field transactionIsolationLock", e); - } - } - // hawkbit uses JDBC and no need of lazy connection fetching - @Override - public ConnectionHandle getJdbcConnection(final EntityManager entityManager, final boolean readOnly) throws PersistenceException { - final Connection connection; - supperTransactionIsolationLock.lock(); - try { - connection = entityManager.unwrap(Connection.class); - } finally { - supperTransactionIsolationLock.unlock(); - } - return () -> connection; - } - @Override public DataAccessException translateExceptionIfPossible(@NonNull final RuntimeException ex) { final DataAccessException dataAccessException = super.translateExceptionIfPossible(ex);