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
This commit is contained in:
Patrick Linskey 2007-11-21 09:20:56 +00:00
parent 21ec161339
commit 99bb160dae
1 changed files with 5 additions and 2 deletions

View File

@ -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");