Sonar Fixes (#2233)
Signed-off-by: Avgustin Marinov <Avgustin.Marinov@bosch.com>
This commit is contained in:
@@ -33,6 +33,8 @@ public class Jpa {
|
||||
log.info("JPA vendor: {}", JPA_VENDOR);
|
||||
}
|
||||
|
||||
// intentional, if it is a constant the compiler will inline it, we want to be changed with changing the JPA vendor lib
|
||||
@SuppressWarnings("java:S3400")
|
||||
public static char nativeQueryParamPrefix() {
|
||||
return '?';
|
||||
}
|
||||
|
||||
@@ -14,6 +14,7 @@ import java.util.Map;
|
||||
|
||||
import javax.sql.DataSource;
|
||||
|
||||
import org.eclipse.hawkbit.tenancy.TenantAware;
|
||||
import org.eclipse.persistence.config.PersistenceUnitProperties;
|
||||
import org.springframework.beans.factory.ObjectProvider;
|
||||
import org.springframework.boot.autoconfigure.orm.jpa.JpaBaseConfiguration;
|
||||
@@ -33,10 +34,14 @@ import org.springframework.transaction.jta.JtaTransactionManager;
|
||||
@Configuration
|
||||
public class JpaConfiguration extends JpaBaseConfiguration {
|
||||
|
||||
private final TenantAware tenantAware;
|
||||
|
||||
protected JpaConfiguration(
|
||||
final DataSource dataSource, final JpaProperties properties,
|
||||
final ObjectProvider<JtaTransactionManager> jtaTransactionManagerProvider) {
|
||||
final ObjectProvider<JtaTransactionManager> jtaTransactionManagerProvider,
|
||||
final TenantAware tenantAware) {
|
||||
super(dataSource, properties, jtaTransactionManagerProvider);
|
||||
this.tenantAware = tenantAware;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -48,7 +53,7 @@ public class JpaConfiguration extends JpaBaseConfiguration {
|
||||
@Override
|
||||
@Bean
|
||||
public PlatformTransactionManager transactionManager(final ObjectProvider<TransactionManagerCustomizers> transactionManagerCustomizers) {
|
||||
return new MultiTenantJpaTransactionManager();
|
||||
return new MultiTenantJpaTransactionManager(tenantAware);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -38,7 +38,6 @@ class MultiTenantJpaTransactionManager extends JpaTransactionManager {
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Autowired
|
||||
private transient TenantAware tenantAware;
|
||||
|
||||
private static final Class<?> JPA_TARGET;
|
||||
@@ -53,6 +52,10 @@ class MultiTenantJpaTransactionManager extends JpaTransactionManager {
|
||||
}
|
||||
}
|
||||
|
||||
MultiTenantJpaTransactionManager(final TenantAware tenantAware) {
|
||||
this.tenantAware = tenantAware;
|
||||
}
|
||||
|
||||
private static final EntityPropertyChangeListener ENTITY_PROPERTY_CHANGE_LISTENER = new EntityPropertyChangeListener();
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user