Skip to content

Commit

Permalink
Bug 579409: Move 'eclipselink.target-database-properties' to initiali…
Browse files Browse the repository at this point in the history
…ze earlier

Signed-off-by: Will Dazey <dazeydev.3@gmail.com>
  • Loading branch information
dazey3 committed Jun 10, 2022
1 parent 8915940 commit db429a6
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* Copyright (c) 1998, 2021 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2015, 2021 IBM Corporation. All rights reserved.
* Copyright (c) 1998, 2022 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2015, 2022 IBM Corporation. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0 which is available at
Expand Down Expand Up @@ -47,6 +47,7 @@
import java.util.Vector;

import org.eclipse.persistence.config.PersistenceUnitProperties;
import org.eclipse.persistence.config.PropertiesUtils;
import org.eclipse.persistence.descriptors.ClassDescriptor;
import org.eclipse.persistence.descriptors.partitioning.PartitioningPolicy;
import org.eclipse.persistence.exceptions.DatabaseException;
Expand Down Expand Up @@ -863,6 +864,13 @@ protected void preConnectDatasource(){
* is connected to.
*/
protected void postConnectDatasource(){
// Initialize the Platform properties now that the datasource is connected and the Platform should be initialized
if((getDatasourcePlatform() instanceof DatabasePlatform)) {
final Platform platform = getDatasourcePlatform();
String dbProperties = (String) getProperties().get(PersistenceUnitProperties.TARGET_DATABASE_PROPERTIES);
PropertiesUtils.set(platform, PersistenceUnitProperties.TARGET_DATABASE_PROPERTIES, dbProperties);
}

if (!hasBroker()) {
initializeDescriptors();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,6 @@
import org.eclipse.persistence.config.ParserType;
import org.eclipse.persistence.config.PersistenceUnitProperties;
import org.eclipse.persistence.config.ProfilerType;
import org.eclipse.persistence.config.PropertiesUtils;
import org.eclipse.persistence.config.RemoteProtocol;
import org.eclipse.persistence.config.SessionCustomizer;
import org.eclipse.persistence.descriptors.ClassDescriptor;
Expand All @@ -206,7 +205,6 @@
import org.eclipse.persistence.internal.databaseaccess.BatchWritingMechanism;
import org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor;
import org.eclipse.persistence.internal.databaseaccess.DatasourcePlatform;
import org.eclipse.persistence.internal.databaseaccess.Platform;
import org.eclipse.persistence.internal.descriptors.OptimisticLockingPolicy;
import org.eclipse.persistence.internal.descriptors.OptimisticLockingPolicy.LockOnChange;
import org.eclipse.persistence.internal.helper.ClassConstants;
Expand Down Expand Up @@ -772,10 +770,6 @@ public AbstractSession deploy(ClassLoader realClassLoader, Map additionalPropert
login(getDatabaseSession(), deployProperties, requiresConnection);
}

final Platform platform = getDatabaseSession().getDatasourcePlatform();
String dbProperties = getConfigPropertyAsStringLogDebug(PersistenceUnitProperties.TARGET_DATABASE_PROPERTIES, deployProperties, this.session);
PropertiesUtils.set(platform, PersistenceUnitProperties.TARGET_DATABASE_PROPERTIES, dbProperties);

// Make JTA integration throw JPA exceptions.
if (this.session.hasExternalTransactionController()) {
if (this.session.getExternalTransactionController().getExceptionHandler() == null) {
Expand Down

0 comments on commit db429a6

Please sign in to comment.