From b96cd1b784995fa703207ea6cf6fb5fbb65d9610 Mon Sep 17 00:00:00 2001 From: Henrique Prange Date: Tue, 19 Feb 2013 22:43:12 -0300 Subject: [PATCH] Enable model migration using data source JNDI This patch adds the required verification in the canMigrateModel method enabling migrations over data source JNDI when possible. --- .../er/extensions/migration/ERXMigrator.java | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/Frameworks/Core/ERExtensions/Sources/er/extensions/migration/ERXMigrator.java b/Frameworks/Core/ERExtensions/Sources/er/extensions/migration/ERXMigrator.java index fcb64b627bf..50a1420351f 100644 --- a/Frameworks/Core/ERExtensions/Sources/er/extensions/migration/ERXMigrator.java +++ b/Frameworks/Core/ERExtensions/Sources/er/extensions/migration/ERXMigrator.java @@ -318,18 +318,21 @@ protected Map _buildDependenciesForModelsNamed(N } protected boolean canMigrateModel(EOModel model) { - boolean canMigrateModel = false; String adaptorName = model.adaptorName(); if ("Memory".equals(adaptorName)) { - canMigrateModel = true; + return true; } - else if ("JDBC".equals(adaptorName)) { + if ("JDBC".equals(adaptorName)) { String url = (String)model.connectionDictionary().objectForKey(JDBCAdaptor.URLKey); - if (url != null && url.toLowerCase().startsWith("jdbc:")) { - canMigrateModel = true; + if ((url != null && url.toLowerCase().startsWith("jdbc:"))) { + return true; + } + String dataSourceJndiName = (String) model.connectionDictionary().objectForKey(JDBCAdaptor.DataSourceJndiNameKey); + if(dataSourceJndiName != null) { + return true; } } - return canMigrateModel; + return false; } protected void _buildDependenciesForModel(EOModel model, int migrateToVersion, Map versions, Map migrations) throws InstantiationException, IllegalAccessException {