diff options
5 files changed, 37 insertions, 12 deletions
diff --git a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/DBStore.java b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/DBStore.java index f591140568..5078fb3277 100644 --- a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/DBStore.java +++ b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/DBStore.java @@ -36,6 +36,7 @@ import org.eclipse.net4j.util.om.monitor.ProgressDistributor; import javax.sql.DataSource; import java.sql.Connection; +import java.sql.SQLException; import java.text.MessageFormat; import java.util.Set; @@ -176,6 +177,16 @@ public class DBStore extends LongIDStore implements IDBStore protected Connection getConnection() { Connection connection = dbConnectionProvider.getConnection(); + + try + { + connection.setAutoCommit(false); + } + catch (SQLException ex) + { + throw new DBException(ex); + } + if (connection == null) { throw new DBException("No connection from connection provider: " + dbConnectionProvider); @@ -293,6 +304,7 @@ public class DBStore extends LongIDStore implements IDBStore { throw new DBException("No row updated in table " + CDODBSchema.REPOSITORY); } + } @Override 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 43ece4085a..31f09eb153 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 @@ -137,17 +137,20 @@ public class DBStoreAccessor extends LongIDStoreAccessor implements IDBStoreAcce protected EClass getObjectType(CDOID id) { - // TODO (taken over from old implementation:) Replace calls to getObjectType by optimized calls to - // RevisionManager.getObjectType (cache!) - CDOClassifierRef type = readObjectType(id); - if (type == null) + EClass result = getStore().getRepository().getRevisionManager().getObjectType(id); + if (result == null) { - return null; - } + CDOClassifierRef type = readObjectType(id); + if (type == null) + { + return null; + } - IRepository repository = getStore().getRepository(); - CDOPackageRegistry packageRegistry = repository.getPackageRegistry(); - return (EClass)type.resolve(packageRegistry); + IRepository repository = getStore().getRepository(); + CDOPackageRegistry packageRegistry = repository.getPackageRegistry(); + result = (EClass)type.resolve(packageRegistry); + } + return result; } public InternalCDORevision readRevision(CDOID id, int listChunk, AdditionalRevisionCache cache) @@ -429,7 +432,7 @@ public class DBStoreAccessor extends LongIDStoreAccessor implements IDBStoreAcce @Override protected void doActivate() throws Exception { - connection = getStore().getDBConnectionProvider().getConnection(); + connection = getStore().getConnection(); connectionKeepAliveTimer = new Timer("Connection-Keep-Alive-" + toString()); connectionKeepAliveTimer.schedule(new ConnectionKeepAliveTask(), ConnectionKeepAliveTask.EXECUTION_PERIOD, diff --git a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/AbstractMappingStrategy.java b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/AbstractMappingStrategy.java index 18b7cce587..75b30ec31f 100644 --- a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/AbstractMappingStrategy.java +++ b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/AbstractMappingStrategy.java @@ -322,7 +322,10 @@ public abstract class AbstractMappingStrategy extends Lifecycle implements IMapp { for (EClass eClass : eClasses) { - createClassMapping(eClass); + if (!(eClass.isInterface() || eClass.isAbstract())) + { + createClassMapping(eClass); + } } } diff --git a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/AbstractHorizontalClassMapping.java b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/AbstractHorizontalClassMapping.java index aa11d0a37a..706c5d3dd8 100644 --- a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/AbstractHorizontalClassMapping.java +++ b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/AbstractHorizontalClassMapping.java @@ -153,6 +153,8 @@ public abstract class AbstractHorizontalClassMapping implements IClassMapping TRACER.format("Executing Query: {0}", pstmt.toString()); } + pstmt.setMaxRows(1); // Optimization: only 1 row + resultSet = pstmt.executeQuery(); if (!resultSet.next()) { diff --git a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/AbstractListTableMapping.java b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/AbstractListTableMapping.java index 8736f9b473..ccf4c9141b 100644 --- a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/AbstractListTableMapping.java +++ b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/AbstractListTableMapping.java @@ -263,6 +263,11 @@ public abstract class AbstractListTableMapping implements IListMapping TRACER.trace(pstmt.toString()); } + if (listChunk != CDORevision.UNCHUNKED) + { + pstmt.setMaxRows(listChunk); // optimization - don't read unneeded rows. + } + resultSet = pstmt.executeQuery(); while ((listChunk == CDORevision.UNCHUNKED || --listChunk >= 0) && resultSet.next()) @@ -341,7 +346,7 @@ public abstract class AbstractListTableMapping implements IListMapping int result = resultSet.getInt(1); if (TRACER.isEnabled()) { - TRACER.trace("Read list size = " + result); + TRACER.trace("Read list last index = " + result); } return result; } |