StringUtils.objectArrayToString(classNames)));
}
// Check if classes are detachable
OMFContext omfCtxSource = ((JDOPersistenceManagerFactory)pmfSource).getOMFContext();
MetaDataManager mmgr = omfCtxSource.getMetaDataManager();
ClassLoaderResolver clr = omfCtxSource.getClassLoaderResolver(null);
for (int i=0;i<classNames.length;i++)
{
AbstractClassMetaData cmd = mmgr.getMetaDataForClass(classNames[i], clr);
if (!cmd.isDetachable())
{
throw new JDOUserException("Class " + classNames[i] + " is not detachable so cannot replicate");
}
}
Object[] detachedObjects = null;
// Detach from datastore 1
if (NucleusLogger.PERSISTENCE.isDebugEnabled())
{
NucleusLogger.PERSISTENCE.debug(LOCALISER_JDO.msg("012053"));
}
PersistenceManager pm1 = pmfSource.getPersistenceManager();
Transaction tx1 = pm1.currentTransaction();
if (getBooleanProperty("datanucleus.replicateObjectGraph"))
{
pm1.getFetchPlan().setGroup(javax.jdo.FetchPlan.ALL);
pm1.getFetchPlan().setMaxFetchDepth(-1);
}
try
{
tx1.begin();
clr = ((JDOPersistenceManager)pm1).getObjectManager().getClassLoaderResolver();
ArrayList objects = new ArrayList();
for (int i=0;i<classNames.length;i++)
{
Class cls = clr.classForName(classNames[i]);
AbstractClassMetaData cmd = mmgr.getMetaDataForClass(cls, clr);
if (!cmd.isEmbeddedOnly())
{
Extent ex = pm1.getExtent(cls);
Iterator iter = ex.iterator();
while (iter.hasNext())