Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--plugins/org.eclipse.emf.cdo.common/META-INF/MANIFEST.MF3
-rw-r--r--plugins/org.eclipse.emf.cdo.server.hibernate/META-INF/MANIFEST.MF1
-rw-r--r--plugins/org.eclipse.emf.cdo.server.hibernate/src/org/eclipse/emf/cdo/server/internal/hibernate/HibernateQueryHandler.java34
3 files changed, 37 insertions, 1 deletions
diff --git a/plugins/org.eclipse.emf.cdo.common/META-INF/MANIFEST.MF b/plugins/org.eclipse.emf.cdo.common/META-INF/MANIFEST.MF
index cd8427cf58..d7ca4569a6 100644
--- a/plugins/org.eclipse.emf.cdo.common/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.emf.cdo.common/META-INF/MANIFEST.MF
@@ -36,7 +36,8 @@ Export-Package: org.eclipse.emf.cdo.common;version="4.2.0",
org.eclipse.emf.cdo.server,
org.eclipse.emf.cdo.server.net4j,
org.eclipse.emf.cdo.ui,
- org.eclipse.emf.cdo.tests",
+ org.eclipse.emf.cdo.tests,
+ org.eclipse.emf.cdo.server.hibernate",
org.eclipse.emf.cdo.internal.common.branch;version="4.2.0";x-friends:="org.eclipse.emf.cdo.tests",
org.eclipse.emf.cdo.internal.common.bundle;version="4.2.0";x-internal:=true,
org.eclipse.emf.cdo.internal.common.commit;version="4.2.0";
diff --git a/plugins/org.eclipse.emf.cdo.server.hibernate/META-INF/MANIFEST.MF b/plugins/org.eclipse.emf.cdo.server.hibernate/META-INF/MANIFEST.MF
index 55c3e8bcd9..f02f7e595e 100644
--- a/plugins/org.eclipse.emf.cdo.server.hibernate/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.emf.cdo.server.hibernate/META-INF/MANIFEST.MF
@@ -11,6 +11,7 @@ Bundle-RequiredExecutionEnvironment: J2SE-1.5
Bundle-ClassPath: .
Eclipse-BuddyPolicy: registered
Require-Bundle: org.eclipse.core.runtime;bundle-version="[3.4.0,4.0.0)",
+ org.eclipse.emf.cdo.common;bundle-version="[4.0.0,5.0.0)",
org.eclipse.emf.cdo.server;bundle-version="[4.0.0,5.0.0)";visibility:=reexport,
org.eclipse.net4j.db;bundle-version="[4.0.0,5.0.0)";visibility:=reexport
Export-Package: org.eclipse.emf.cdo.server.hibernate;version="4.2.0",
diff --git a/plugins/org.eclipse.emf.cdo.server.hibernate/src/org/eclipse/emf/cdo/server/internal/hibernate/HibernateQueryHandler.java b/plugins/org.eclipse.emf.cdo.server.hibernate/src/org/eclipse/emf/cdo/server/internal/hibernate/HibernateQueryHandler.java
index 9619becaa0..b87eed9f0e 100644
--- a/plugins/org.eclipse.emf.cdo.server.hibernate/src/org/eclipse/emf/cdo/server/internal/hibernate/HibernateQueryHandler.java
+++ b/plugins/org.eclipse.emf.cdo.server.hibernate/src/org/eclipse/emf/cdo/server/internal/hibernate/HibernateQueryHandler.java
@@ -11,14 +11,17 @@
*/
package org.eclipse.emf.cdo.server.internal.hibernate;
+import org.eclipse.emf.cdo.common.branch.CDOBranchVersion;
import org.eclipse.emf.cdo.common.id.CDOID;
import org.eclipse.emf.cdo.common.revision.CDORevision;
import org.eclipse.emf.cdo.common.util.CDOQueryInfo;
+import org.eclipse.emf.cdo.internal.common.branch.CDOBranchVersionImpl;
import org.eclipse.emf.cdo.server.IQueryContext;
import org.eclipse.emf.cdo.server.IQueryHandler;
import org.eclipse.emf.cdo.server.hibernate.IHibernateStore;
import org.eclipse.emf.cdo.server.internal.hibernate.tuplizer.WrappedHibernateList;
import org.eclipse.emf.cdo.spi.common.revision.InternalCDORevision;
+import org.eclipse.emf.cdo.spi.common.revision.InternalCDORevisionManager;
import org.eclipse.emf.ecore.EReference;
import org.eclipse.emf.ecore.EStructuralFeature;
@@ -210,11 +213,42 @@ public class HibernateQueryHandler implements IQueryHandler
{
if (!(o instanceof TeneoAuditEntry))
{
+ // repair revision numbers
+ if (o instanceof InternalCDORevision && hibernateStoreAccessor.getStore().isAuditing())
+ {
+ final InternalCDORevision internalCDORevision = (InternalCDORevision)o;
+ // a later revision, get the previous revision
+ if (internalCDORevision.getVersion() > 1)
+ {
+ final CDORevision previousVersion = getPreviousRevision(internalCDORevision);
+ if (previousVersion != null)
+ {
+ internalCDORevision.setBranchPoint(hibernateStoreAccessor.getStore().getMainBranchHead().getBranch()
+ .getPoint(1 + previousVersion.getRevised()));
+ }
+ }
+ }
+
return o;
}
return hibernateAuditHandler.convertAuditEntryToCDORevision((TeneoAuditEntry)o);
}
+ private CDORevision getPreviousRevision(InternalCDORevision internalCDORevision)
+ {
+ final InternalCDORevisionManager cdoRevisionManager = hibernateStoreAccessor.getStore().getRepository()
+ .getRevisionManager();
+
+ final CDOBranchVersion cdoBranchVersion = new CDOBranchVersionImpl(hibernateStoreAccessor.getStore()
+ .getMainBranchHead().getBranch(), internalCDORevision.getVersion() - 1);
+ if (cdoRevisionManager.containsRevisionByVersion(internalCDORevision.getID(), cdoBranchVersion))
+ {
+ return cdoRevisionManager.getRevisionByVersion(internalCDORevision.getID(), cdoBranchVersion, -1, true);
+ }
+ return hibernateStoreAccessor.readRevisionByVersion(internalCDORevision.getID(), cdoBranchVersion, -1,
+ cdoRevisionManager);
+ }
+
private void addToRevisionCache(CDORevision revision)
{
final InternalCDORevision internalRevision = (InternalCDORevision)revision;

Back to the top