mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Merged HEAD-BUG-FIX (5.0/Cloud) to HEAD (4.3/Cloud)
71584: Merged V4.2-BUG-FIX (4.2.3) to HEAD-BUG-FIX (4.3/Cloud) 70325: Merged V4.1-BUG-FIX (4.1.9) to V4.2-BUG-FIX (4.2.3) 70145: MNT-8629: Merged DEV to V4.1-BUG-FIX (4.1.9) 70077: MNT-8629: Support requested for DB2 when schema name does not match DB user name. - Take into account schema name during update git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@74685 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2005-2013 Alfresco Software Limited.
|
||||
* Copyright (C) 2005-2010 Alfresco Software Limited.
|
||||
*
|
||||
* This file is part of Alfresco
|
||||
*
|
||||
@@ -229,6 +229,17 @@ public class SchemaBootstrap extends AbstractLifecycleBean
|
||||
this.descriptorService = descriptorService;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Defines the DatabaseMetaDataHelper to be used
|
||||
*
|
||||
* @param databaseMetaDataHelper
|
||||
*/
|
||||
public void setDatabaseMetaDataHelper(DatabaseMetaDataHelper databaseMetaDataHelper)
|
||||
{
|
||||
this.databaseMetaDataHelper = databaseMetaDataHelper;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the previously auto-detected Hibernate dialect.
|
||||
*
|
||||
@@ -260,6 +271,7 @@ public class SchemaBootstrap extends AbstractLifecycleBean
|
||||
private int maximumStringLength;
|
||||
private Properties globalProperties;
|
||||
private String dbSchemaName;
|
||||
private DatabaseMetaDataHelper databaseMetaDataHelper;
|
||||
|
||||
private ThreadLocal<StringBuilder> executedStatementsThreadLocal = new ThreadLocal<StringBuilder>();
|
||||
|
||||
@@ -563,7 +575,7 @@ public class SchemaBootstrap extends AbstractLifecycleBean
|
||||
*/
|
||||
private int countAppliedPatches(Configuration cfg, Connection connection) throws Exception
|
||||
{
|
||||
String defaultSchema = dbSchemaName != null ? dbSchemaName : DatabaseMetaDataHelper.getSchema(connection);
|
||||
String defaultSchema = dbSchemaName != null ? dbSchemaName : databaseMetaDataHelper.getSchema(connection);
|
||||
|
||||
if (defaultSchema != null && defaultSchema.length() == 0)
|
||||
{
|
||||
@@ -1021,7 +1033,7 @@ public class SchemaBootstrap extends AbstractLifecycleBean
|
||||
setJobExecutorActivate(false).
|
||||
buildProcessEngine();
|
||||
|
||||
String schemaName = dbSchemaName != null ? dbSchemaName : DatabaseMetaDataHelper.getSchema(connection);
|
||||
String schemaName = dbSchemaName != null ? dbSchemaName : databaseMetaDataHelper.getSchema(connection);
|
||||
// create or upgrade the DB schema
|
||||
engine.getManagementService().databaseSchemaUpgrade(connection, null, schemaName);
|
||||
}
|
||||
@@ -1774,6 +1786,17 @@ public class SchemaBootstrap extends AbstractLifecycleBean
|
||||
{
|
||||
logger.warn("Error closing DB connection: " + e.getMessage());
|
||||
}
|
||||
try
|
||||
{
|
||||
if (session != null)
|
||||
{
|
||||
session.close();
|
||||
}
|
||||
}
|
||||
catch (Throwable e)
|
||||
{
|
||||
logger.warn("Error closing Hibernate session: " + e.getMessage());
|
||||
}
|
||||
// Remove the connection reference from the threadlocal boostrap
|
||||
SchemaBootstrapConnectionProvider.setBootstrapConnection(null);
|
||||
|
||||
@@ -1866,7 +1889,7 @@ public class SchemaBootstrap extends AbstractLifecycleBean
|
||||
XMLToSchema xmlToSchema = new XMLToSchema(is);
|
||||
xmlToSchema.parse();
|
||||
Schema reference = xmlToSchema.getSchema();
|
||||
ExportDb exporter = new ExportDb(dataSource, dialect, descriptorService);
|
||||
ExportDb exporter = new ExportDb(dataSource, dialect, descriptorService, databaseMetaDataHelper);
|
||||
exporter.setDbSchemaName(dbSchemaName);
|
||||
// Ensure that the database objects we're validating are filtered
|
||||
// by the same prefix as the reference file.
|
||||
|
Reference in New Issue
Block a user