Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2016-04-25 03:48:11 -0400
committerEike Stepper2016-04-25 03:48:11 -0400
commit208baa123869f9c70bcb60b9b801897ea834effc (patch)
treef3e5ad2121c77d03e3c3c420d3743fd56a960653
parente164a8f10f412b2d282228f27bf134ad941f404b (diff)
downloadcdo-committers/estepper/commit-after-ddl2.tar.gz
cdo-committers/estepper/commit-after-ddl2.tar.xz
cdo-committers/estepper/commit-after-ddl2.zip
-rw-r--r--plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/DBStoreAccessor.java11
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/spi/server/StoreAccessor.java6
-rw-r--r--plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/Bugzilla_XXXXXX_Test.java43
-rw-r--r--plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/DBConfigs.java1
4 files changed, 58 insertions, 3 deletions
diff --git a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/DBStoreAccessor.java b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/DBStoreAccessor.java
index 80f45e7846..ffe1d603bb 100644
--- a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/DBStoreAccessor.java
+++ b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/DBStoreAccessor.java
@@ -166,7 +166,7 @@ public class DBStoreAccessor extends StoreAccessor implements IDBStoreAccessor,
public IDBPreparedStatement getPreparedStatement(String sql, ReuseProbability reuseProbability)
{
org.eclipse.net4j.db.IDBPreparedStatement.ReuseProbability converted = //
- org.eclipse.net4j.db.IDBPreparedStatement.ReuseProbability.values()[reuseProbability.ordinal()];
+ org.eclipse.net4j.db.IDBPreparedStatement.ReuseProbability.values()[reuseProbability.ordinal()];
return connection.prepareStatement(sql, converted);
}
@@ -896,7 +896,14 @@ public class DBStoreAccessor extends StoreAccessor implements IDBStoreAccessor,
IMappingStrategy mappingStrategy = store.getMappingStrategy();
mappingStrategy.createMapping(connection, packageUnits, monitor.fork());
+
+ int writePackageUnits; // TODO Extra commit needed for Mysql between DDL and DML.
+ // connection.commit();
}
+ // catch (SQLException ex)
+ // {
+ // throw new DBException(ex);
+ // }
finally
{
monitor.done();
@@ -1308,7 +1315,7 @@ public class DBStoreAccessor extends StoreAccessor implements IDBStoreAccessor,
Connection connection = getConnection();
Collection<InternalCDOPackageUnit> imported = //
- metaDataManager.rawImport(connection, in, fromCommitTime, toCommitTime, monitor.fork());
+ metaDataManager.rawImport(connection, in, fromCommitTime, toCommitTime, monitor.fork());
packageUnits.addAll(imported);
if (!packageUnits.isEmpty())
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/spi/server/StoreAccessor.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/spi/server/StoreAccessor.java
index b929622f43..8e4536f925 100644
--- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/spi/server/StoreAccessor.java
+++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/spi/server/StoreAccessor.java
@@ -75,7 +75,7 @@ public abstract class StoreAccessor extends StoreAccessorBase
try
{
- monitor.begin(1 + newPackageUnits.length + 2 + newObjects.length + detachedObjects.length + dirtyCount + 1);
+ monitor.begin(newPackageUnits.length + 3 + newObjects.length + detachedObjects.length + dirtyCount + 1);
writeCommitInfo(branch, timeStamp, previousTimeStamp, userID, commitComment, monitor.fork());
writePackageUnits(newPackageUnits, monitor.fork(newPackageUnits.length));
@@ -85,6 +85,10 @@ public abstract class StoreAccessor extends StoreAccessorBase
{
addIDMappings(context, monitor.fork());
}
+ else
+ {
+ monitor.worked();
+ }
applyIDMappings(context, monitor);
diff --git a/plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/Bugzilla_XXXXXX_Test.java b/plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/Bugzilla_XXXXXX_Test.java
new file mode 100644
index 0000000000..27734b1630
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/Bugzilla_XXXXXX_Test.java
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2016 Eike Stepper (Berlin, Germany) and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ */
+package org.eclipse.emf.cdo.tests.db;
+
+import org.eclipse.emf.cdo.eresource.CDOResource;
+import org.eclipse.emf.cdo.session.CDOSession;
+import org.eclipse.emf.cdo.tests.AbstractCDOTest;
+import org.eclipse.emf.cdo.transaction.CDOTransaction;
+
+/**
+ * @author Eike Stepper
+ */
+public class Bugzilla_XXXXXX_Test extends AbstractCDOTest
+{
+ @CleanRepositoriesBefore(reason = "Package mapping")
+ public void testConsecutivePackageAdditions() throws Exception
+ {
+ CDOSession session = openSession();
+ CDOTransaction transaction = session.openTransaction();
+ CDOResource resource = transaction.createResource(getResourcePath("/my/resource"));
+
+ resource.getContents().add(getModel1Factory().createCompany());
+ transaction.commit();
+
+ session.close();
+ restartRepository();
+ session = openSession();
+ transaction = session.openTransaction();
+ resource = transaction.getResource(getResourcePath("/my/resource"));
+
+ resource.getContents().add(getModel2Factory().createSpecialPurchaseOrder());
+ resource.getContents().add(getModel1Factory().createCompany());
+ transaction.commit();
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/DBConfigs.java b/plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/DBConfigs.java
index bde5b498ee..4d82fd1728 100644
--- a/plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/DBConfigs.java
+++ b/plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/DBConfigs.java
@@ -41,6 +41,7 @@ public abstract class DBConfigs extends AllConfigs
testClasses.add(SQLQueryTest.class);
testClasses.add(Bugzilla_351068_Test.class);
testClasses.add(Bugzilla_396743_Test.class);
+ testClasses.add(Bugzilla_XXXXXX_Test.class);
super.initTestClasses(testClasses, scenario);
testClasses.remove(MEMStoreQueryTest.class);

Back to the top