summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Taal2008-03-13 16:39:19 (EDT)
committerMartin Taal2008-03-13 16:39:19 (EDT)
commitf7668e1eaa47be00e3082f2aa91d7dd8c66ccdfd (patch)
tree64fd620bb8d8a1c09052be46d95b6ca7eb8c036e
parent7f71cbe2e0b9b74c68cbbdd9351f845dc34d5ac3 (diff)
downloadcdo-f7668e1eaa47be00e3082f2aa91d7dd8c66ccdfd.zip
cdo-f7668e1eaa47be00e3082f2aa91d7dd8c66ccdfd.tar.gz
cdo-f7668e1eaa47be00e3082f2aa91d7dd8c66ccdfd.tar.bz2
Updated version handling
-rw-r--r--plugins/org.eclipse.emf.cdo.server.hibernate.teneo/src/org/eclipse/emf/cdo/server/hibernate/teneo/TeneoHibernateMappingProvider.java1
-rw-r--r--plugins/org.eclipse.emf.cdo.server.hibernate/src/org/eclipse/emf/cdo/server/internal/hibernate/HibernateStoreWriter.java22
-rw-r--r--plugins/org.eclipse.emf.cdo.tests.hibernate/src/org/eclipse/emf/cdo/tests/hibernate/AllTests.java25
3 files changed, 28 insertions, 20 deletions
diff --git a/plugins/org.eclipse.emf.cdo.server.hibernate.teneo/src/org/eclipse/emf/cdo/server/hibernate/teneo/TeneoHibernateMappingProvider.java b/plugins/org.eclipse.emf.cdo.server.hibernate.teneo/src/org/eclipse/emf/cdo/server/hibernate/teneo/TeneoHibernateMappingProvider.java
index 0eb32c4..2c09abc 100644
--- a/plugins/org.eclipse.emf.cdo.server.hibernate.teneo/src/org/eclipse/emf/cdo/server/hibernate/teneo/TeneoHibernateMappingProvider.java
+++ b/plugins/org.eclipse.emf.cdo.server.hibernate.teneo/src/org/eclipse/emf/cdo/server/hibernate/teneo/TeneoHibernateMappingProvider.java
@@ -52,6 +52,7 @@ public class TeneoHibernateMappingProvider implements IHibernateMappingProvider
final String mapping = generateMapping();
TRACER.trace("Generated hibernate mapping:");
TRACER.trace(mapping);
+ System.err.println(mapping);
configuration.addXML(mapping);
TRACER.trace("Added mapping to configuration");
}
diff --git a/plugins/org.eclipse.emf.cdo.server.hibernate/src/org/eclipse/emf/cdo/server/internal/hibernate/HibernateStoreWriter.java b/plugins/org.eclipse.emf.cdo.server.hibernate/src/org/eclipse/emf/cdo/server/internal/hibernate/HibernateStoreWriter.java
index f59ce1c..6804178 100644
--- a/plugins/org.eclipse.emf.cdo.server.hibernate/src/org/eclipse/emf/cdo/server/internal/hibernate/HibernateStoreWriter.java
+++ b/plugins/org.eclipse.emf.cdo.server.hibernate/src/org/eclipse/emf/cdo/server/internal/hibernate/HibernateStoreWriter.java
@@ -13,6 +13,7 @@ package org.eclipse.emf.cdo.server.internal.hibernate;
import org.eclipse.emf.cdo.internal.protocol.model.CDOClassProxy;
import org.eclipse.emf.cdo.internal.protocol.model.InternalCDOClass;
+import org.eclipse.emf.cdo.internal.protocol.revision.CDORevisionImpl;
import org.eclipse.emf.cdo.protocol.model.CDOFeature;
import org.eclipse.emf.cdo.protocol.model.CDOPackage;
import org.eclipse.emf.cdo.protocol.revision.CDORevision;
@@ -22,6 +23,7 @@ import org.eclipse.emf.cdo.server.hibernate.IHibernateStoreWriter;
import org.eclipse.emf.cdo.server.internal.hibernate.bundle.OM;
import org.eclipse.net4j.internal.util.om.trace.ContextTracer;
+import org.eclipse.net4j.util.WrappedException;
import org.hibernate.FlushMode;
import org.hibernate.Session;
@@ -69,11 +71,23 @@ public class HibernateStoreWriter extends HibernateStoreReader implements IHiber
for (Object o : context.getDirtyObjects())
{
- final CDORevision cdoRevision = (CDORevision)o;
- session.update(HibernateUtil.getInstance().getEntityName(cdoRevision), o);
- if (TRACER.isEnabled())
+ try
+ {
+ final CDORevision cdoRevision = (CDORevision)o;
+ if (cdoRevision instanceof CDORevisionImpl)
+ {
+ ((CDORevisionImpl)cdoRevision).setVersion(cdoRevision.getVersion() - 1);
+ }
+ session.update(HibernateUtil.getInstance().getEntityName(cdoRevision), o);
+ if (TRACER.isEnabled())
+ {
+ TRACER.trace("Updated Object " + ((CDORevision)o).getCDOClass().getName() + " id: " + cdoRevision.getID());
+ }
+ }
+ catch (Exception e)
{
- TRACER.trace("Updated Object " + ((CDORevision)o).getCDOClass().getName() + " id: " + cdoRevision.getID());
+ e.printStackTrace(System.err);
+ throw WrappedException.wrap(e);
}
}
diff --git a/plugins/org.eclipse.emf.cdo.tests.hibernate/src/org/eclipse/emf/cdo/tests/hibernate/AllTests.java b/plugins/org.eclipse.emf.cdo.tests.hibernate/src/org/eclipse/emf/cdo/tests/hibernate/AllTests.java
index 2ac429c..ffdf3b1 100644
--- a/plugins/org.eclipse.emf.cdo.tests.hibernate/src/org/eclipse/emf/cdo/tests/hibernate/AllTests.java
+++ b/plugins/org.eclipse.emf.cdo.tests.hibernate/src/org/eclipse/emf/cdo/tests/hibernate/AllTests.java
@@ -10,8 +10,6 @@
**************************************************************************/
package org.eclipse.emf.cdo.tests.hibernate;
-import org.eclipse.emf.cdo.tests.ChunkingTest;
-import org.eclipse.emf.cdo.tests.ChunkingWithMEMTest;
import org.eclipse.emf.cdo.tests.ContainmentTest;
import org.eclipse.emf.cdo.tests.CrossReferenceTest;
import org.eclipse.emf.cdo.tests.EnumTest;
@@ -42,12 +40,11 @@ public class AllTests
TestSuite suite = new TestSuite("Tests for CDO using Hibernate");
- if (true)
- {
- return suite;
- }
// PASS>>>
+ suite.addTestSuite(EnumTest.class);
+ suite.addTestSuite(InitialTest.class);
suite.addTestSuite(ResourceTest.class);
+ suite.addTestSuite(RollbackTest.class);
suite.addTestSuite(ContainmentTest.class);
suite.addTestSuite(StateMachineTest.class);
suite.addTestSuite(ViewTest.class);
@@ -57,22 +54,18 @@ public class AllTests
suite.addTestSuite(NoLegacyTest.class);
// FAIL>>>
- suite.addTestSuite(InitialTest.class);
- // failures: testCommitDirty
suite.addTestSuite(InvalidationTest.class);
// failures: testSeparateView, testSeparateViewNotification, testSeparateSession
- suite.addTestSuite(RollbackTest.class);
- // failes: testRollbackSameSession, testRollbackSeparateSession
- suite.addTestSuite(ChunkingTest.class);
- // failures: /testWriteNative, testChunkWithTemporaryObject
- suite.addTestSuite(ChunkingWithMEMTest.class);
- // failures testReadNative, testWriteNative
suite.addTestSuite(TransactionDeadLockTest.class);
// failures: testCreateManySession, testCreateManyTransaction
suite.addTestSuite(RevisionDeltaTest.class);
// Remark: I don't think hibernate won't support this.
- suite.addTestSuite(EnumTest.class);
- // failures: testTransient, testAttached
+
+ // Chunking is not supported by Hibernate
+ // suite.addTestSuite(ChunkingTest.class);
+ // failures: /testWriteNative, testChunkWithTemporaryObject
+ // suite.addTestSuite(ChunkingWithMEMTest.class);
+ // failures testReadNative, testWriteNative
// $JUnit-BEGIN$
// TODO suite.addTestSuite(GeneratedEcoreTest.class);