You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@isis.apache.org by da...@apache.org on 2022/08/02 12:57:30 UTC

[isis] branch master updated: ISIS-3107: allows multiple placeholders in create schema template

This is an automated email from the ASF dual-hosted git repository.

danhaywood pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/isis.git


The following commit(s) were added to refs/heads/master by this push:
     new b682ecf079 ISIS-3107: allows multiple placeholders in create schema template
b682ecf079 is described below

commit b682ecf07976646b236ce131c0f806ecf7e5fa27
Author: Dan Haywood <da...@haywood-associates.co.uk>
AuthorDate: Tue Aug 2 13:56:28 2022 +0100

    ISIS-3107: allows multiple placeholders in create schema template
---
 .../jdo/datanucleus/IsisModulePersistenceJdoDatanucleus.java       | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/persistence/jdo/datanucleus/src/main/java/org/apache/isis/persistence/jdo/datanucleus/IsisModulePersistenceJdoDatanucleus.java b/persistence/jdo/datanucleus/src/main/java/org/apache/isis/persistence/jdo/datanucleus/IsisModulePersistenceJdoDatanucleus.java
index 1373f73b7e..f3048871c2 100644
--- a/persistence/jdo/datanucleus/src/main/java/org/apache/isis/persistence/jdo/datanucleus/IsisModulePersistenceJdoDatanucleus.java
+++ b/persistence/jdo/datanucleus/src/main/java/org/apache/isis/persistence/jdo/datanucleus/IsisModulePersistenceJdoDatanucleus.java
@@ -294,16 +294,19 @@ public class IsisModulePersistenceJdoDatanucleus {
 
         if(!persistenceSchemaConf.getAutoCreateSchemas().isEmpty()) {
 
+            val createSchemaSqlTemplate = persistenceSchemaConf.getCreateSchemaSqlTemplate();
+
             log.info("About to create db schema(s) {} with template '{}'",
                     persistenceSchemaConf.getAutoCreateSchemas(),
-                    persistenceSchemaConf.getCreateSchemaSqlTemplate());
+                    createSchemaSqlTemplate);
 
             try(val con = dataSource.getConnection()){
 
                 val s = con.createStatement();
 
                 for(val schema : persistenceSchemaConf.getAutoCreateSchemas()) {
-                    val sql = String.format(persistenceSchemaConf.getCreateSchemaSqlTemplate(), schema);
+                    // in case there are multiple placeholders, we specify the string multiple times.
+                    val sql = String.format(createSchemaSqlTemplate, schema, schema, schema, schema, schema, schema, schema);
                     log.info("SQL '{}'", sql);
                     s.execute(sql);
                 }