diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/batch/SampleBatchRegistration.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/batch/SampleBatchRegistration.java
index 2467ba5f32de0509d8251ccb404ac35f52eb7c3a..e1f73d83a3c8777c42d69cdbf3f6dae17c0e91b0 100644
--- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/batch/SampleBatchRegistration.java
+++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/batch/SampleBatchRegistration.java
@@ -39,19 +39,28 @@ public class SampleBatchRegistration implements IBatchOperation<NewSample>, IPro
 
     private int maxIndex;
 
+    private int limit;
+
     public SampleBatchRegistration(ISampleTable businessTable, List<NewSample> entities,
             PersonPE registratorOrNull)
+    {
+        this(businessTable, entities, registratorOrNull, 50000);
+    }
+
+    public SampleBatchRegistration(ISampleTable businessTable, List<NewSample> entities,
+            PersonPE registratorOrNull, int limit)
     {
         this.businessTable = businessTable;
         this.entities = entities;
         this.registratorOrNull = registratorOrNull;
+        this.limit = limit;
     }
 
     @Override
     public void execute(List<NewSample> batch)
     {
         businessTable.prepareForRegistration(batch, registratorOrNull);
-        businessTable.save(maxIndex - endIndex > 50000);
+        businessTable.save(maxIndex - endIndex > limit);
     }
 
     @Override
diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/batch/SampleBatchUpdate.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/batch/SampleBatchUpdate.java
index 5d068dd793c7e875ed4ea115469f7bbed047d23c..504e46ae5aadc79d7530933eee0c6430fb4fe932 100644
--- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/batch/SampleBatchUpdate.java
+++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/batch/SampleBatchUpdate.java
@@ -36,17 +36,21 @@ public class SampleBatchUpdate implements IBatchOperation<SampleBatchUpdatesDTO>
 
     private int maxIndex;
 
-    public SampleBatchUpdate(ISampleTable businessTable, List<SampleBatchUpdatesDTO> entities)
+    int limit;
+
+    public SampleBatchUpdate(ISampleTable businessTable, List<SampleBatchUpdatesDTO> entities,
+            int limit)
     {
         this.businessTable = businessTable;
         this.entities = entities;
+        this.limit = limit;
     }
 
     @Override
     public void execute(List<SampleBatchUpdatesDTO> updates)
     {
         businessTable.prepareForUpdate(updates);
-        businessTable.save(maxIndex - endIndex > 50000);
+        businessTable.save(maxIndex - endIndex > limit);
     }
 
     @Override
diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/server/GenericSampleTypeSlaveServerPlugin.java b/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/server/GenericSampleTypeSlaveServerPlugin.java
index 04e75110bd8e01f65bbfcd18fba75770c3f41dd6..ad0e2cc9ae947201333be6c627e9ac83f0961d13 100644
--- a/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/server/GenericSampleTypeSlaveServerPlugin.java
+++ b/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/server/GenericSampleTypeSlaveServerPlugin.java
@@ -17,12 +17,15 @@
 package ch.systemsx.cisd.openbis.plugin.generic.server;
 
 import java.util.List;
+import java.util.Properties;
 
+import javax.annotation.PostConstruct;
 import javax.annotation.Resource;
 
 import org.springframework.stereotype.Component;
 
 import ch.systemsx.cisd.common.exceptions.UserFailureException;
+import ch.systemsx.cisd.common.spring.ExposablePropertyPlaceholderConfigurer;
 import ch.systemsx.cisd.openbis.generic.server.ComponentNames;
 import ch.systemsx.cisd.openbis.generic.server.batch.BatchOperationExecutor;
 import ch.systemsx.cisd.openbis.generic.server.batch.SampleBatchRegistration;
@@ -53,10 +56,31 @@ public final class GenericSampleTypeSlaveServerPlugin implements ISampleTypeSlav
     @Resource(name = ComponentNames.DAO_FACTORY)
     private IDAOFactory daoFactory;
 
+    @Resource(name = ExposablePropertyPlaceholderConfigurer.PROPERTY_CONFIGURER_BEAN_NAME)
+    protected ExposablePropertyPlaceholderConfigurer configurer;
+
+    private int sessionCacheEntityLimit = 50000;
+
     private GenericSampleTypeSlaveServerPlugin()
     {
     }
 
+    @PostConstruct
+    public void init()
+    {
+        Properties props = this.configurer.getResolvedProps();
+        String text = props.getProperty("hibernate.batch.sessionCache.maxEntities");
+        if (text != null)
+        {
+            try
+            {
+                sessionCacheEntityLimit = Integer.parseInt(text);
+            } catch (NumberFormatException e)
+            {
+            }
+        }
+    }
+
     //
     // ISlaveServerPlugin
     //
@@ -82,8 +106,10 @@ public final class GenericSampleTypeSlaveServerPlugin implements ISampleTypeSlav
         assert session != null : "Unspecified session.";
         assert newSamples != null && newSamples.size() > 0 : "Unspecified sample or empty samples.";
 
-        BatchOperationExecutor.executeInBatches(new SampleBatchRegistration(businessObjectFactory
-                .createSampleTable(session), newSamples, registratorOrNull));
+        BatchOperationExecutor
+                .executeInBatches(new SampleBatchRegistration(businessObjectFactory
+                        .createSampleTable(session), newSamples, registratorOrNull,
+                        sessionCacheEntityLimit));
     }
 
     @Override
@@ -93,6 +119,6 @@ public final class GenericSampleTypeSlaveServerPlugin implements ISampleTypeSlav
         assert updateSamples != null && updateSamples.size() > 0 : "Unspecified sample or empty samples.";
 
         BatchOperationExecutor.executeInBatches(new SampleBatchUpdate(businessObjectFactory
-                .createSampleTable(session), updateSamples));
+                .createSampleTable(session), updateSamples, sessionCacheEntityLimit));
     }
 }
diff --git a/openbis/source/java/service.properties b/openbis/source/java/service.properties
index f4cf1a687398fa861c5f345b13d2114d926b1ffa..8301ef08f570486032181818c0f5263e270a2338 100644
--- a/openbis/source/java/service.properties
+++ b/openbis/source/java/service.properties
@@ -87,6 +87,9 @@ hibernate.search.batch-size = 1000
 hibernate.search.maxResults = 100000
 # If 'async', the update of indices will be done in a separate thread.
 hibernate.search.worker.execution=async
+# Limit of entities stored in hibernate session cache during batch processing. Default 50000.
+# Note - this is our own setting, not Hibernate's.
+#hibernate.batch.sessionCache.maxEntities = 50000
 
 # Online Help
 #