From 99bb160daeec3c60b2fa1cbd4fb8fe7780fc3fdc Mon Sep 17 00:00:00 2001 From: Patrick Linskey Date: Wed, 21 Nov 2007 09:20:56 +0000 Subject: [PATCH] While looking at dynamic class loading, I noticed that we create a separate MappingRepository when doing an in-process schema redefinion. This seems to lead to potentially-out-of-sync states in the main configuration MappingRepository; this change shares the Configuration's repository with the MappingTool. It looks like the old behavior was somewhat implicit, so I'm hoping that it wasn't necessary, and that this change will be a step forward. git-svn-id: https://svn.apache.org/repos/asf/openjpa/trunk@597002 13f79535-47bb-0310-9956-ffa450edef68 --- .../org/apache/openjpa/jdbc/kernel/JDBCBrokerFactory.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/JDBCBrokerFactory.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/JDBCBrokerFactory.java index 78e26bd92..a64d63fba 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/JDBCBrokerFactory.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/JDBCBrokerFactory.java @@ -26,6 +26,7 @@ import java.util.Properties; import org.apache.commons.lang.StringUtils; import org.apache.openjpa.jdbc.conf.JDBCConfiguration; import org.apache.openjpa.jdbc.conf.JDBCConfigurationImpl; +import org.apache.openjpa.jdbc.meta.MappingRepository; import org.apache.openjpa.jdbc.meta.MappingTool; import org.apache.openjpa.kernel.AbstractBrokerFactory; import org.apache.openjpa.kernel.Bootstrap; @@ -145,14 +146,16 @@ public class JDBCBrokerFactory if (StringUtils.isEmpty(action)) return; - Collection classes = conf.getMetaDataRepositoryInstance(). - loadPersistentTypes(false, loader); + MappingRepository repo = conf.getMappingRepositoryInstance(); + Collection classes = repo.loadPersistentTypes(false, loader); if (classes.isEmpty()) return; String props = Configurations.getProperties(action); action = Configurations.getClassName(action); MappingTool tool = new MappingTool(conf, action, false); + tool.setRepository(repo); + tool.setSchemaGroup(tool.getSchemaGroup()); Configurations.configureInstance(tool, conf, props, "SynchronizeMappings");