Set target-database property 09/117609/1
authorJim Hahn <jrh3@att.com>
Fri, 5 Feb 2021 16:03:41 +0000 (11:03 -0500)
committerJim Hahn <jrh3@att.com>
Mon, 8 Feb 2021 20:19:14 +0000 (15:19 -0500)
The new version of eclipselink doesn't recognize mariaDB by default.
Added an optional property, databaseType, to the DB parameter class,
which defaults to "MySQL" if not set.  ("MySQL" is what web discussions
indicated should be used for mariaDB.)

Issue-ID: POLICY-3005
Change-Id: I7af9b65a53e0090944af6ce40d5cffa13a4123d7
Signed-off-by: Jim Hahn <jrh3@att.com>
models-provider/src/main/java/org/onap/policy/models/provider/PolicyModelsProviderParameters.java
models-provider/src/main/java/org/onap/policy/models/provider/impl/AbstractModelsProvider.java

index e2784b0..1934555 100644 (file)
@@ -1,7 +1,7 @@
 /*-
  * ============LICENSE_START=======================================================
  *  Copyright (C) 2019 Nordix Foundation.
 /*-
  * ============LICENSE_START=======================================================
  *  Copyright (C) 2019 Nordix Foundation.
- *  Modifications Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ *  Modifications Copyright (C) 2019, 2021 AT&T Intellectual Property. All rights reserved.
  *  Modifications Copyright (C) 2020 Bell Canada. All rights reserved.
  * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
  *  Modifications Copyright (C) 2020 Bell Canada. All rights reserved.
  * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -56,6 +56,7 @@ public class PolicyModelsProviderParameters implements ParameterGroup {
 
     private String name;
     private String implementation = DEFAULT_IMPLEMENTATION;
 
     private String name;
     private String implementation = DEFAULT_IMPLEMENTATION;
+    private String databaseType;
     private String databaseDriver;
     private String databaseUrl;
     private String databaseUser;
     private String databaseDriver;
     private String databaseUrl;
     private String databaseUser;
index 818cc44..a0c5ce6 100644 (file)
@@ -1,6 +1,7 @@
 /*-
  * ============LICENSE_START=======================================================
  *  Copyright (C) 2021 Nordix Foundation.
 /*-
  * ============LICENSE_START=======================================================
  *  Copyright (C) 2021 Nordix Foundation.
+ *  Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved.
  * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -83,6 +84,8 @@ public abstract class AbstractModelsProvider implements Closeable {
         jdbcProperties.setProperty(PersistenceUnitProperties.JDBC_URL,      parameters.getDatabaseUrl());
         jdbcProperties.setProperty(PersistenceUnitProperties.JDBC_USER,     parameters.getDatabaseUser());
         jdbcProperties.setProperty(PersistenceUnitProperties.JDBC_PASSWORD, parameters.getDatabasePassword());
         jdbcProperties.setProperty(PersistenceUnitProperties.JDBC_URL,      parameters.getDatabaseUrl());
         jdbcProperties.setProperty(PersistenceUnitProperties.JDBC_USER,     parameters.getDatabaseUser());
         jdbcProperties.setProperty(PersistenceUnitProperties.JDBC_PASSWORD, parameters.getDatabasePassword());
+        jdbcProperties.setProperty(PersistenceUnitProperties.TARGET_DATABASE,
+                        (parameters.getDatabaseType() == null ? "MySQL" : parameters.getDatabaseType()));
         // @formatter:on
 
         daoParameters.setJdbcProperties(jdbcProperties);
         // @formatter:on
 
         daoParameters.setJdbcProperties(jdbcProperties);