From 208b8e268cfa3b3220fc8d4024281581a7c735de Mon Sep 17 00:00:00 2001
From: buczekp <buczekp>
Date: Wed, 23 Sep 2009 10:54:23 +0000
Subject: [PATCH] [LMS-1189] removed h2 database code - part 1

SVN: 12694
---
 openbis/.classpath                            |   1 -
 .../server/CommonBusinessObjectFactory.java   |   1 +
 .../PropertiesSetListingQueryFallback.java    |  81 --------
 ...ropertiesSetListingQueryFullTableScan.java | 106 ----------
 .../PropertiesSetListingQueryOneByOne.java    | 159 --------------
 .../bo/common/QueryStrategyChooser.java       |  64 ------
 .../bo/common/entity/SecondaryEntityDAO.java  |  33 +--
 ...econdaryEntitySetListingQueryFallback.java | 140 -------------
 .../bo/datasetlister/DatasetListerDAO.java    |  86 +-------
 .../DatasetSetListingQueryFallback.java       |  68 ------
 .../DatasetSetListingQueryFullTableScan.java  |  78 -------
 .../DatasetSetListingQueryOneByOne.java       |  80 -------
 .../datasetlister/IDatasetListingQuery.java   |  65 ------
 .../bo/samplelister/SampleListerDAO.java      |  88 +-------
 .../SampleSetListingQueryFallback.java        |  58 ------
 .../SampleSetListingQueryFullTableScan.java   |  69 -------
 .../SampleSetListingQueryOneByOne.java        |  69 -------
 .../h2/SampleCodeUniquenessCheckTrigger.java  | 195 ------------------
 openbis/source/java/service.properties        |   2 +-
 openbis/source/sql/h2/039/domains-039.sql     |  20 --
 openbis/source/sql/h2/039/function-039.sql    |   7 -
 openbis/source/sql/h2/040/domains-040.sql     |  20 --
 openbis/source/sql/h2/040/function-040.sql    |   7 -
 openbis/source/sql/h2/041/domains-041.sql     |  20 --
 openbis/source/sql/h2/041/function-041.sql    |   7 -
 .../DatasetListingQueryTest.java              |  81 --------
 .../server/dataaccess/db/AbstractDAOTest.java |   1 -
 27 files changed, 19 insertions(+), 1587 deletions(-)
 delete mode 100644 openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/common/PropertiesSetListingQueryFallback.java
 delete mode 100644 openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/common/PropertiesSetListingQueryFullTableScan.java
 delete mode 100644 openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/common/PropertiesSetListingQueryOneByOne.java
 delete mode 100644 openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/common/QueryStrategyChooser.java
 delete mode 100644 openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/common/entity/SecondaryEntitySetListingQueryFallback.java
 delete mode 100644 openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/datasetlister/DatasetSetListingQueryFallback.java
 delete mode 100644 openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/datasetlister/DatasetSetListingQueryFullTableScan.java
 delete mode 100644 openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/datasetlister/DatasetSetListingQueryOneByOne.java
 delete mode 100644 openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/samplelister/SampleSetListingQueryFallback.java
 delete mode 100644 openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/samplelister/SampleSetListingQueryFullTableScan.java
 delete mode 100644 openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/samplelister/SampleSetListingQueryOneByOne.java
 delete mode 100644 openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/h2/SampleCodeUniquenessCheckTrigger.java
 delete mode 100644 openbis/source/sql/h2/039/domains-039.sql
 delete mode 100644 openbis/source/sql/h2/039/function-039.sql
 delete mode 100644 openbis/source/sql/h2/040/domains-040.sql
 delete mode 100644 openbis/source/sql/h2/040/function-040.sql
 delete mode 100644 openbis/source/sql/h2/041/domains-041.sql
 delete mode 100644 openbis/source/sql/h2/041/function-041.sql

diff --git a/openbis/.classpath b/openbis/.classpath
index dc9c6963aa0..98c36aaff21 100644
--- a/openbis/.classpath
+++ b/openbis/.classpath
@@ -50,7 +50,6 @@
 	<classpathentry kind="lib" path="/libraries/apgdiff/apgdiff.jar" sourcepath="/libraries/apgdiff/src.zip"/>
 	<classpathentry kind="lib" path="/libraries/cisd-base/cisd-base-test.jar" sourcepath="/libraries/cisd-base/cisd-base-src.zip"/>
 	<classpathentry kind="lib" path="/libraries/cisd-base/cisd-base.jar" sourcepath="/libraries/cisd-base/cisd-base-src.zip"/>
-	<classpathentry kind="lib" path="/libraries/h2/h2.jar" sourcepath="/libraries/h2/src.zip"/>
 	<classpathentry kind="lib" path="/libraries/eodsql/eodsql.jar" sourcepath="/libraries/eodsql/eodsql_src.zip"/>
 	<classpathentry kind="lib" path="/libraries/fastutil/fastutil.jar" sourcepath="/libraries/fastutil/fastutil-src.zip"/>
 	<classpathentry kind="lib" path="/libraries/commons-collections-generic/commons-collections-generic.jar" sourcepath="/libraries/commons-collections-generic/src.zip"/>
diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/CommonBusinessObjectFactory.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/CommonBusinessObjectFactory.java
index 6fb177e4fe5..3735876e0aa 100644
--- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/CommonBusinessObjectFactory.java
+++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/CommonBusinessObjectFactory.java
@@ -103,6 +103,7 @@ public final class CommonBusinessObjectFactory extends AbstractBusinessObjectFac
         return new SampleTable(getDaoFactory(), session);
     }
 
+    // TODO getDaoFactory()?
     public ISampleLister createSampleLister(Session session)
     {
         return SampleLister.create(daoFactory, session.getBaseIndexURL());
diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/common/PropertiesSetListingQueryFallback.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/common/PropertiesSetListingQueryFallback.java
deleted file mode 100644
index b6024d940e3..00000000000
--- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/common/PropertiesSetListingQueryFallback.java
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- * Copyright 2009 ETH Zuerich, CISD
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package ch.systemsx.cisd.openbis.generic.server.business.bo.common;
-
-import it.unimi.dsi.fastutil.longs.LongSet;
-
-import ch.rinn.restrictions.Friend;
-
-/**
- * A fallback implementation of {@link IEntityPropertySetListingQuery} for database engines who
- * don't support querying for identifier sets.
- * 
- * @author Bernd Rinn
- */
-@Friend(toClasses = IEntityPropertyListingQuery.class)
-public class PropertiesSetListingQueryFallback implements IEntityPropertySetListingQuery
-{
-    private final IEntityPropertySetListingQuery oneByOneDelegate;
-
-    private final IEntityPropertySetListingQuery fullTableScanDelegate;
-
-    private final QueryStrategyChooser strategyChooser;
-
-    public PropertiesSetListingQueryFallback(final IEntityPropertyListingQuery query,
-            QueryStrategyChooser strategyChooser)
-    {
-        this.oneByOneDelegate = new PropertiesSetListingQueryOneByOne(query);
-        this.fullTableScanDelegate = new PropertiesSetListingQueryFullTableScan(query);
-        this.strategyChooser = strategyChooser;
-    }
-
-    public Iterable<GenericEntityPropertyRecord> getEntityPropertyGenericValues(
-            final LongSet entityIDs)
-    {
-        if (strategyChooser.useFullTableScan(entityIDs))
-        {
-            return fullTableScanDelegate.getEntityPropertyGenericValues(entityIDs);
-        } else
-        {
-            return oneByOneDelegate.getEntityPropertyGenericValues(entityIDs);
-        }
-    }
-
-    public Iterable<MaterialEntityPropertyRecord> getEntityPropertyMaterialValues(
-            final LongSet entityIDs)
-    {
-        if (strategyChooser.useFullTableScan(entityIDs))
-        {
-            return fullTableScanDelegate.getEntityPropertyMaterialValues(entityIDs);
-        } else
-        {
-            return oneByOneDelegate.getEntityPropertyMaterialValues(entityIDs);
-        }
-    }
-
-    public Iterable<VocabularyTermRecord> getEntityPropertyVocabularyTermValues(
-            final LongSet entityIDs)
-    {
-        if (strategyChooser.useFullTableScan(entityIDs))
-        {
-            return fullTableScanDelegate.getEntityPropertyVocabularyTermValues(entityIDs);
-        } else
-        {
-            return oneByOneDelegate.getEntityPropertyVocabularyTermValues(entityIDs);
-        }
-    }
-}
diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/common/PropertiesSetListingQueryFullTableScan.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/common/PropertiesSetListingQueryFullTableScan.java
deleted file mode 100644
index 42cf4988650..00000000000
--- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/common/PropertiesSetListingQueryFullTableScan.java
+++ /dev/null
@@ -1,106 +0,0 @@
-/*
- * Copyright 2009 ETH Zuerich, CISD
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package ch.systemsx.cisd.openbis.generic.server.business.bo.common;
-
-import it.unimi.dsi.fastutil.longs.LongSet;
-
-import java.util.Iterator;
-
-import org.apache.commons.collections15.Predicate;
-import org.apache.commons.collections15.iterators.FilterIterator;
-
-import ch.rinn.restrictions.Friend;
-
-/**
- * An implementation of {@link IEntityPropertyListingQuery} which gets all all rows and then filters
- * them down by entity id. This will be a faster way of getting the entities then getting them one
- * by one (as {@link PropertiesSetListingQueryOneByOne} does) when a the requested entities are a
- * considerable part of all entities.
- * 
- * @author Bernd Rinn
- */
-@Friend(toClasses =
-    { IEntityPropertyListingQuery.class })
-class PropertiesSetListingQueryFullTableScan implements IEntityPropertySetListingQuery
-{
-    private final IEntityPropertyListingQuery query;
-
-    public PropertiesSetListingQueryFullTableScan(final IEntityPropertyListingQuery query)
-    {
-        this.query = query;
-    }
-
-    public Iterable<GenericEntityPropertyRecord> getEntityPropertyGenericValues(
-            final LongSet entityIDs)
-    {
-        return new Iterable<GenericEntityPropertyRecord>()
-            {
-                public Iterator<GenericEntityPropertyRecord> iterator()
-                {
-                    return new FilterIterator<GenericEntityPropertyRecord>(query
-                            .getEntityPropertyGenericValues(),
-                            new Predicate<BaseEntityPropertyRecord>()
-                                {
-                                    public boolean evaluate(BaseEntityPropertyRecord baseSample)
-                                    {
-                                        return entityIDs.contains(baseSample.entity_id);
-                                    }
-                                });
-                }
-            };
-    }
-
-    public Iterable<MaterialEntityPropertyRecord> getEntityPropertyMaterialValues(
-            final LongSet entityIDs)
-    {
-        return new Iterable<MaterialEntityPropertyRecord>()
-            {
-                public Iterator<MaterialEntityPropertyRecord> iterator()
-                {
-                    return new FilterIterator<MaterialEntityPropertyRecord>(query
-                            .getEntityPropertyMaterialValues(),
-                            new Predicate<BaseEntityPropertyRecord>()
-                                {
-                                    public boolean evaluate(BaseEntityPropertyRecord baseSample)
-                                    {
-                                        return entityIDs.contains(baseSample.entity_id);
-                                    }
-                                });
-                }
-            };
-    }
-
-    public Iterable<VocabularyTermRecord> getEntityPropertyVocabularyTermValues(
-            final LongSet entityIDs)
-    {
-        return new Iterable<VocabularyTermRecord>()
-            {
-                public Iterator<VocabularyTermRecord> iterator()
-                {
-                    return new FilterIterator<VocabularyTermRecord>(query
-                            .getEntityPropertyVocabularyTermValues(),
-                            new Predicate<BaseEntityPropertyRecord>()
-                                {
-                                    public boolean evaluate(BaseEntityPropertyRecord baseSample)
-                                    {
-                                        return entityIDs.contains(baseSample.entity_id);
-                                    }
-                                });
-                }
-            };
-    }
-}
diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/common/PropertiesSetListingQueryOneByOne.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/common/PropertiesSetListingQueryOneByOne.java
deleted file mode 100644
index 1d0e03fb19e..00000000000
--- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/common/PropertiesSetListingQueryOneByOne.java
+++ /dev/null
@@ -1,159 +0,0 @@
-/*
- * Copyright 2009 ETH Zuerich, CISD
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package ch.systemsx.cisd.openbis.generic.server.business.bo.common;
-
-import it.unimi.dsi.fastutil.longs.LongIterator;
-import it.unimi.dsi.fastutil.longs.LongSet;
-
-import java.util.Iterator;
-
-import net.lemnik.eodsql.DataIterator;
-
-import ch.rinn.restrictions.Friend;
-
-/**
- * An implementation of {@link IEntityPropertySetListingQuery} that gets the entity properties one
- * by one.
- * 
- * @author Bernd Rinn
- */
-@Friend(toClasses =
-    { IEntityPropertySetListingQuery.class, IEntityPropertyListingQuery.class })
-class PropertiesSetListingQueryOneByOne implements IEntityPropertySetListingQuery
-{
-    private final IEntityPropertyListingQuery query;
-
-    public PropertiesSetListingQueryOneByOne(final IEntityPropertyListingQuery query)
-    {
-        this.query = query;
-    }
-
-    public Iterable<GenericEntityPropertyRecord> getEntityPropertyGenericValues(
-            final LongSet entityIDs)
-    {
-        return new Iterable<GenericEntityPropertyRecord>()
-            {
-                public Iterator<GenericEntityPropertyRecord> iterator()
-                {
-                    final LongIterator outerIt = entityIDs.iterator();
-                    return new Iterator<GenericEntityPropertyRecord>()
-                        {
-                            DataIterator<GenericEntityPropertyRecord> innerIt = null;
-
-                            public boolean hasNext()
-                            {
-                                while ((innerIt == null || innerIt.hasNext() == false)
-                                        && outerIt.hasNext())
-                                {
-                                    innerIt =
-                                            query
-                                                    .getEntityPropertyGenericValues(outerIt
-                                                            .nextLong());
-                                }
-                                return (innerIt != null && innerIt.isClosed() == false);
-                            }
-
-                            public GenericEntityPropertyRecord next()
-                            {
-                                return innerIt.next();
-                            }
-
-                            public void remove() throws UnsupportedOperationException
-                            {
-                                throw new UnsupportedOperationException();
-                            }
-                        };
-                }
-            };
-    }
-
-    public Iterable<MaterialEntityPropertyRecord> getEntityPropertyMaterialValues(
-            final LongSet entityIDs)
-    {
-        return new Iterable<MaterialEntityPropertyRecord>()
-            {
-                public Iterator<MaterialEntityPropertyRecord> iterator()
-                {
-                    final LongIterator outerIt = entityIDs.iterator();
-                    return new Iterator<MaterialEntityPropertyRecord>()
-                        {
-                            DataIterator<MaterialEntityPropertyRecord> innerIt = null;
-
-                            public boolean hasNext()
-                            {
-                                while ((innerIt == null || innerIt.hasNext() == false)
-                                        && outerIt.hasNext())
-                                {
-                                    innerIt =
-                                            query.getEntityPropertyMaterialValues(outerIt
-                                                    .nextLong());
-                                }
-                                return (innerIt != null && innerIt.isClosed() == false);
-                            }
-
-                            public MaterialEntityPropertyRecord next()
-                            {
-                                return innerIt.next();
-                            }
-
-                            public void remove() throws UnsupportedOperationException
-                            {
-                                throw new UnsupportedOperationException();
-                            }
-                        };
-                }
-            };
-    }
-
-    public Iterable<VocabularyTermRecord> getEntityPropertyVocabularyTermValues(
-            final LongSet entityIDs)
-    {
-        return new Iterable<VocabularyTermRecord>()
-            {
-                public Iterator<VocabularyTermRecord> iterator()
-                {
-                    final LongIterator outerIt = entityIDs.iterator();
-                    return new Iterator<VocabularyTermRecord>()
-                        {
-                            DataIterator<VocabularyTermRecord> innerIt = null;
-
-                            public boolean hasNext()
-                            {
-                                while ((innerIt == null || innerIt.hasNext() == false)
-                                        && outerIt.hasNext())
-                                {
-                                    innerIt =
-                                            query.getEntityPropertyVocabularyTermValues(outerIt
-                                                    .nextLong());
-                                }
-                                return (innerIt != null && innerIt.isClosed() == false);
-                            }
-
-                            public VocabularyTermRecord next()
-                            {
-                                return innerIt.next();
-                            }
-
-                            public void remove() throws UnsupportedOperationException
-                            {
-                                throw new UnsupportedOperationException();
-                            }
-                        };
-                }
-            };
-    }
-}
diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/common/QueryStrategyChooser.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/common/QueryStrategyChooser.java
deleted file mode 100644
index 287476d5f9a..00000000000
--- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/common/QueryStrategyChooser.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Copyright 2009 ETH Zuerich, CISD
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package ch.systemsx.cisd.openbis.generic.server.business.bo.common;
-
-import it.unimi.dsi.fastutil.longs.LongSet;
-
-/**
- * Helps deciding what kind of sql query would be more efficient: full table scan with filtering or
- * querying about each single item separately. Decides on the basis of the number of items in the
- * whole table.
- * 
- * @author Tomasz Pylak
- */
-public class QueryStrategyChooser
-{
-    private final long UPDATE_INTERVAL = 10 * 60 * 1000L; // 10 minutes
-
-    private final float FULL_TABLE_SCAN_THRESHOLD = 0.2f;
-
-    public interface IEntitiesCountProvider
-    {
-        long count();
-    }
-
-    private final IEntitiesCountProvider countProvider;
-
-    private long numberOfEntitiesLastUpdatedTime;
-
-    private long numberOfEntities;
-
-    public QueryStrategyChooser(IEntitiesCountProvider countProvider)
-    {
-        this.countProvider = countProvider;
-    }
-
-    private synchronized long getNumberOfEntities()
-    {
-        if (System.currentTimeMillis() - numberOfEntitiesLastUpdatedTime > UPDATE_INTERVAL)
-        {
-            numberOfEntities = countProvider.count();
-            numberOfEntitiesLastUpdatedTime = System.currentTimeMillis();
-        }
-        return numberOfEntities;
-    }
-
-    public boolean useFullTableScan(final LongSet entityIDs)
-    {
-        return entityIDs.size() >= getNumberOfEntities() * FULL_TABLE_SCAN_THRESHOLD;
-    }
-}
diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/common/entity/SecondaryEntityDAO.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/common/entity/SecondaryEntityDAO.java
index a942598e5a6..9f3831bc1f2 100644
--- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/common/entity/SecondaryEntityDAO.java
+++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/common/entity/SecondaryEntityDAO.java
@@ -30,8 +30,6 @@ import org.springframework.dao.EmptyResultDataAccessException;
 import ch.rinn.restrictions.Friend;
 import ch.rinn.restrictions.Private;
 import ch.systemsx.cisd.openbis.generic.server.business.bo.common.DatabaseContextUtils;
-import ch.systemsx.cisd.openbis.generic.server.business.bo.common.QueryStrategyChooser;
-import ch.systemsx.cisd.openbis.generic.server.business.bo.common.QueryStrategyChooser.IEntitiesCountProvider;
 import ch.systemsx.cisd.openbis.generic.server.dataaccess.IDAOFactory;
 import ch.systemsx.cisd.openbis.generic.server.dataaccess.PersistencyResources;
 import ch.systemsx.cisd.openbis.generic.shared.basic.dto.DatabaseInstance;
@@ -79,8 +77,7 @@ public class SecondaryEntityDAO
     public static SecondaryEntityDAO create(IDAOFactory daoFactory,
             ISecondaryEntityListingQuery query)
     {
-        final boolean supportsSetQuery = DatabaseContextUtils.isSupportingSetQueries(daoFactory);
-        return new SecondaryEntityDAO(supportsSetQuery, query, daoFactory.getHomeDatabaseInstance());
+        return new SecondaryEntityDAO(query, daoFactory.getHomeDatabaseInstance());
     }
 
     private final ISecondaryEntitySetListingQuery setQuery;
@@ -89,26 +86,18 @@ public class SecondaryEntityDAO
 
     private final DatabaseInstance databaseInstance;
 
-    private SecondaryEntityDAO(boolean supportsSetQuery, final ISecondaryEntityListingQuery query,
+    private SecondaryEntityDAO(final ISecondaryEntityListingQuery query,
             final DatabaseInstancePE databaseInstancePE)
     {
         this.query = query;
-        this.setQuery = createSetQuery(supportsSetQuery, query, databaseInstancePE.getId());
+        this.setQuery = createSetQuery(query, databaseInstancePE.getId());
         this.databaseInstance = DatabaseInstanceTranslator.translate(databaseInstancePE);
     }
 
-    private static ISecondaryEntitySetListingQuery createSetQuery(boolean supportsSetQuery,
+    private static ISecondaryEntitySetListingQuery createSetQuery(
             ISecondaryEntityListingQuery query, long databaseInstanceId)
     {
-        if (supportsSetQuery)
-        {
-            return asDatasetSetListingQuery(query);
-        } else
-        {
-            QueryStrategyChooser strategyChooser = createStrategyChooser(query, databaseInstanceId);
-            return new SecondaryEntitySetListingQueryFallback(query, strategyChooser,
-                    databaseInstanceId);
-        }
+        return asDatasetSetListingQuery(query);
     }
 
     private static ISecondaryEntitySetListingQuery asDatasetSetListingQuery(
@@ -123,18 +112,6 @@ public class SecondaryEntityDAO
             };
     }
 
-    private static QueryStrategyChooser createStrategyChooser(
-            final ISecondaryEntityListingQuery query, final long databaseInstanceId)
-    {
-        return new QueryStrategyChooser(new IEntitiesCountProvider()
-            {
-                public long count()
-                {
-                    return query.getSampleCount(databaseInstanceId);
-                }
-            });
-    }
-
     public Experiment getExperiment(final long experimentId)
     {
         final ExperimentProjectGroupCodeRecord record =
diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/common/entity/SecondaryEntitySetListingQueryFallback.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/common/entity/SecondaryEntitySetListingQueryFallback.java
deleted file mode 100644
index deea86cc8bd..00000000000
--- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/common/entity/SecondaryEntitySetListingQueryFallback.java
+++ /dev/null
@@ -1,140 +0,0 @@
-/*
- * Copyright 2009 ETH Zuerich, CISD
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package ch.systemsx.cisd.openbis.generic.server.business.bo.common.entity;
-
-import it.unimi.dsi.fastutil.longs.LongIterator;
-import it.unimi.dsi.fastutil.longs.LongSet;
-
-import java.util.Iterator;
-
-import org.apache.commons.collections15.Predicate;
-import org.apache.commons.collections15.iterators.FilterIterator;
-
-import ch.rinn.restrictions.Friend;
-import ch.systemsx.cisd.openbis.generic.server.business.bo.common.QueryStrategyChooser;
-import ch.systemsx.cisd.openbis.generic.server.business.bo.common.entity.SecondaryEntityDAO.ISecondaryEntitySetListingQuery;
-
-/**
- * A fallback implementation of {@link ISecondaryEntitySetListingQuery} for database engines who
- * don't support querying for identifier sets.
- * 
- * @author Tomasz Pylak
- */
-@Friend(toClasses =
-    { ISecondaryEntityListingQuery.class, SampleReferenceRecord.class })
-class SecondaryEntitySetListingQueryFallback implements ISecondaryEntitySetListingQuery
-{
-    private final ISecondaryEntitySetListingQuery oneByOneDelegate;
-
-    private final ISecondaryEntitySetListingQuery fullTableScanDelegate;
-
-    private final QueryStrategyChooser strategyChooser;
-
-    public SecondaryEntitySetListingQueryFallback(final ISecondaryEntityListingQuery query,
-            QueryStrategyChooser strategyChooser, long databaseInstanceId)
-    {
-        this.strategyChooser = strategyChooser;
-        this.oneByOneDelegate = new SecondaryEntitySetListingQueryOneByOne(query);
-        this.fullTableScanDelegate =
-                new SecondaryEntitySetListingQueryFullTableScan(query, databaseInstanceId);
-    }
-
-    public Iterable<SampleReferenceRecord> getSamples(LongSet sampleIds)
-    {
-        if (strategyChooser.useFullTableScan(sampleIds))
-        {
-            return fullTableScanDelegate.getSamples(sampleIds);
-        } else
-        {
-            return oneByOneDelegate.getSamples(sampleIds);
-        }
-    }
-
-    private static class SecondaryEntitySetListingQueryOneByOne implements
-            ISecondaryEntitySetListingQuery
-    {
-        private final ISecondaryEntityListingQuery query;
-
-        public SecondaryEntitySetListingQueryOneByOne(ISecondaryEntityListingQuery query)
-        {
-            this.query = query;
-        }
-
-        public Iterable<SampleReferenceRecord> getSamples(final LongSet sampleIds)
-        {
-            return new Iterable<SampleReferenceRecord>()
-                {
-                    public Iterator<SampleReferenceRecord> iterator()
-                    {
-                        final LongIterator it = sampleIds.iterator();
-                        return new Iterator<SampleReferenceRecord>()
-                            {
-                                public boolean hasNext()
-                                {
-                                    return it.hasNext();
-                                }
-
-                                public SampleReferenceRecord next()
-                                {
-                                    return query.getSample(it.nextLong());
-                                }
-
-                                public void remove() throws UnsupportedOperationException
-                                {
-                                    throw new UnsupportedOperationException();
-                                }
-                            };
-                    }
-                };
-        }
-    }
-
-    private static class SecondaryEntitySetListingQueryFullTableScan implements
-            ISecondaryEntitySetListingQuery
-    {
-        private final ISecondaryEntityListingQuery query;
-
-        private final long databaseInstanceId;
-
-        public SecondaryEntitySetListingQueryFullTableScan(ISecondaryEntityListingQuery query,
-                long databaseInstanceId)
-        {
-            this.query = query;
-            this.databaseInstanceId = databaseInstanceId;
-        }
-
-        public Iterable<SampleReferenceRecord> getSamples(final LongSet sampleIds)
-        {
-            return new Iterable<SampleReferenceRecord>()
-                {
-                    public Iterator<SampleReferenceRecord> iterator()
-                    {
-                        return new FilterIterator<SampleReferenceRecord>(query
-                                .getAllSamples(databaseInstanceId),
-                                new Predicate<SampleReferenceRecord>()
-                                    {
-                                        public boolean evaluate(SampleReferenceRecord sample)
-                                        {
-                                            return sampleIds.contains(sample.id);
-                                        }
-                                    });
-                    }
-                };
-        }
-
-    }
-}
diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/datasetlister/DatasetListerDAO.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/datasetlister/DatasetListerDAO.java
index 57d8446b2fd..aa2f1f4bd0b 100644
--- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/datasetlister/DatasetListerDAO.java
+++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/datasetlister/DatasetListerDAO.java
@@ -31,10 +31,7 @@ import ch.systemsx.cisd.openbis.generic.server.business.bo.common.GenericEntityP
 import ch.systemsx.cisd.openbis.generic.server.business.bo.common.IEntityPropertyListingQuery;
 import ch.systemsx.cisd.openbis.generic.server.business.bo.common.IEntityPropertySetListingQuery;
 import ch.systemsx.cisd.openbis.generic.server.business.bo.common.MaterialEntityPropertyRecord;
-import ch.systemsx.cisd.openbis.generic.server.business.bo.common.PropertiesSetListingQueryFallback;
-import ch.systemsx.cisd.openbis.generic.server.business.bo.common.QueryStrategyChooser;
 import ch.systemsx.cisd.openbis.generic.server.business.bo.common.VocabularyTermRecord;
-import ch.systemsx.cisd.openbis.generic.server.business.bo.common.QueryStrategyChooser.IEntitiesCountProvider;
 import ch.systemsx.cisd.openbis.generic.server.dataaccess.IDAOFactory;
 import ch.systemsx.cisd.openbis.generic.server.dataaccess.PersistencyResources;
 import ch.systemsx.cisd.openbis.generic.shared.dto.DatabaseInstancePE;
@@ -76,19 +73,14 @@ public final class DatasetListerDAO extends AbstractDAO
 
     private final IEntityPropertySetListingQuery propertySetQuery;
 
-    private final QueryStrategyChooser strategyChooser;
-
     DatasetListerDAO(final boolean supportsSetQuery, IDatasetListingFullQuery query,
             final DatabaseInstancePE databaseInstance)
     {
         super(databaseInstance);
         this.query = query;
-        this.strategyChooser = createStrategyChooser(query);
-        this.setQuery =
-                createIdSetQuery(supportsSetQuery, query, strategyChooser, getDatabaseInstanceId());
+        this.setQuery = createIdSetQuery(supportsSetQuery, query, getDatabaseInstanceId());
         this.propertySetQuery =
-                createSetPropertyQuery(supportsSetQuery, query, strategyChooser,
-                        getDatabaseInstanceId());
+                createSetPropertyQuery(supportsSetQuery, query, getDatabaseInstanceId());
     }
 
     IDatasetListingQuery getQuery()
@@ -106,69 +98,10 @@ public final class DatasetListerDAO extends AbstractDAO
         return propertySetQuery;
     }
 
-    private static QueryStrategyChooser createStrategyChooser(final IDatasetListingFullQuery query)
-    {
-        return new QueryStrategyChooser(new IEntitiesCountProvider()
-            {
-                public long count()
-                {
-                    return query.getDatasetCount();
-                }
-            });
-    }
-
     private static IEntityPropertySetListingQuery createSetPropertyQuery(boolean supportsSetQuery,
-            IDatasetListingFullQuery query, QueryStrategyChooser strategyChooser,
-            long databaseInstanceId)
+            IDatasetListingFullQuery query, long databaseInstanceId)
     {
-        if (supportsSetQuery)
-        {
-            return asEntitySetPropertyListingQuery(query);
-        } else
-        {
-            return new PropertiesSetListingQueryFallback(asEntityPropertyListingQuery(query,
-                    databaseInstanceId), strategyChooser);
-        }
-    }
-
-    private static IEntityPropertyListingQuery asEntityPropertyListingQuery(
-            final IDatasetListingFullQuery query, final long databaseInstanceId)
-    {
-        return new IEntityPropertyListingQuery()
-            {
-                public DataIterator<GenericEntityPropertyRecord> getEntityPropertyGenericValues()
-                {
-                    return query.getAllEntityPropertyGenericValues(databaseInstanceId);
-                }
-
-                public DataIterator<GenericEntityPropertyRecord> getEntityPropertyGenericValues(
-                        long entityId)
-                {
-                    return query.getEntityPropertyGenericValues(entityId);
-                }
-
-                public DataIterator<MaterialEntityPropertyRecord> getEntityPropertyMaterialValues()
-                {
-                    return query.getAllEntityPropertyMaterialValues(databaseInstanceId);
-                }
-
-                public DataIterator<MaterialEntityPropertyRecord> getEntityPropertyMaterialValues(
-                        long sampleId)
-                {
-                    return query.getEntityPropertyMaterialValues(sampleId);
-                }
-
-                public DataIterator<VocabularyTermRecord> getEntityPropertyVocabularyTermValues()
-                {
-                    return query.getAllEntityPropertyVocabularyTermValues(databaseInstanceId);
-                }
-
-                public DataIterator<VocabularyTermRecord> getEntityPropertyVocabularyTermValues(
-                        long sampleId)
-                {
-                    return query.getEntityPropertyVocabularyTermValues(sampleId);
-                }
-            };
+        return asEntitySetPropertyListingQuery(query);
     }
 
     private static IEntityPropertySetListingQuery asEntitySetPropertyListingQuery(
@@ -197,16 +130,9 @@ public final class DatasetListerDAO extends AbstractDAO
     }
 
     private static IDatasetSetListingQuery createIdSetQuery(boolean supportsSetQuery,
-            IDatasetListingFullQuery query, QueryStrategyChooser strategyChooser,
-            long databaseInstanceId)
+            IDatasetListingFullQuery query, long databaseInstanceId)
     {
-        if (supportsSetQuery)
-        {
-            return asDatasetSetListingQuery(query);
-        } else
-        {
-            return new DatasetSetListingQueryFallback(query, strategyChooser, databaseInstanceId);
-        }
+        return asDatasetSetListingQuery(query);
     }
 
     private static IDatasetSetListingQuery asDatasetSetListingQuery(
diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/datasetlister/DatasetSetListingQueryFallback.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/datasetlister/DatasetSetListingQueryFallback.java
deleted file mode 100644
index 38951dc43e1..00000000000
--- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/datasetlister/DatasetSetListingQueryFallback.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * Copyright 2009 ETH Zuerich, CISD
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package ch.systemsx.cisd.openbis.generic.server.business.bo.datasetlister;
-
-import it.unimi.dsi.fastutil.longs.LongSet;
-import net.lemnik.eodsql.DataIterator;
-
-import ch.rinn.restrictions.Friend;
-import ch.systemsx.cisd.common.exceptions.NotImplementedException;
-import ch.systemsx.cisd.openbis.generic.server.business.bo.common.QueryStrategyChooser;
-
-/**
- * A fallback implementation of {@link IDatasetSetListingQuery} for database engines who don't
- * support querying for identifier sets.
- * 
- * @author Tomasz Pylak
- */
-@Friend(toClasses =
-    { IDatasetListingQuery.class })
-class DatasetSetListingQueryFallback implements IDatasetSetListingQuery
-{
-    private final IDatasetSetListingQuery oneByOneDelegate;
-
-    private final IDatasetSetListingQuery fullTableScanDelegate;
-
-    private final QueryStrategyChooser strategyChooser;
-
-    public DatasetSetListingQueryFallback(final IDatasetListingQuery query,
-            QueryStrategyChooser strategyChooser, long databaseInstanceId)
-    {
-        this.strategyChooser = strategyChooser;
-        this.oneByOneDelegate = new DatasetSetListingQueryOneByOne(query);
-        this.fullTableScanDelegate =
-                new DatasetSetListingQueryFullTableScan(query, databaseInstanceId);
-    }
-
-    public Iterable<DatasetRecord> getDatasets(final LongSet sampleIds)
-    {
-        if (strategyChooser.useFullTableScan(sampleIds))
-        {
-            return fullTableScanDelegate.getDatasets(sampleIds);
-        } else
-        {
-            return oneByOneDelegate.getDatasets(sampleIds);
-        }
-    }
-
-    // TODO 2009-09-01, Tomasz Pylak: implement me! (h2)
-    public DataIterator<Long> getDatasetChildrenIds(LongSet entityIds)
-    {
-        throw new NotImplementedException();
-    }
-
-}
diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/datasetlister/DatasetSetListingQueryFullTableScan.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/datasetlister/DatasetSetListingQueryFullTableScan.java
deleted file mode 100644
index 86f2680a30c..00000000000
--- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/datasetlister/DatasetSetListingQueryFullTableScan.java
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * Copyright 2009 ETH Zuerich, CISD
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package ch.systemsx.cisd.openbis.generic.server.business.bo.datasetlister;
-
-import it.unimi.dsi.fastutil.longs.LongSet;
-
-import java.util.Iterator;
-
-import net.lemnik.eodsql.DataIterator;
-
-import org.apache.commons.collections15.Predicate;
-import org.apache.commons.collections15.iterators.FilterIterator;
-
-import ch.rinn.restrictions.Friend;
-import ch.systemsx.cisd.common.exceptions.NotImplementedException;
-
-/**
- * An implementation of {@link IDatasetSetListingQuery} which gets all all rows and then filters
- * them down by sample id. This will be a faster way of getting the datasets then getting them one
- * by one (as {@link DatasetSetListingQueryOneByOne} does) when a the requested datasets are a
- * considerable part of all datasets.
- * 
- * @author Tomasz Pylak
- */
-@Friend(toClasses =
-    { DatasetRecord.class, IDatasetListingQuery.class })
-class DatasetSetListingQueryFullTableScan implements IDatasetSetListingQuery
-{
-    private final long databaseInstanceId;
-
-    private final IDatasetListingQuery query;
-
-    public DatasetSetListingQueryFullTableScan(final IDatasetListingQuery query,
-            final long databaseInstanceId)
-    {
-        this.query = query;
-        this.databaseInstanceId = databaseInstanceId;
-    }
-
-    public Iterable<DatasetRecord> getDatasets(final LongSet datasetIds)
-    {
-        return new Iterable<DatasetRecord>()
-            {
-                public Iterator<DatasetRecord> iterator()
-                {
-                    return new FilterIterator<DatasetRecord>(query.getDatasets(databaseInstanceId),
-                            new Predicate<DatasetRecord>()
-                                {
-                                    public boolean evaluate(DatasetRecord dataset)
-                                    {
-                                        return datasetIds.contains(dataset.id);
-                                    }
-                                });
-                }
-            };
-    }
-
-    // TODO 2009-09-01, Tomasz Pylak: implement me! (h2)
-    public DataIterator<Long> getDatasetChildrenIds(LongSet entityIds)
-    {
-        throw new NotImplementedException();
-    }
-
-}
diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/datasetlister/DatasetSetListingQueryOneByOne.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/datasetlister/DatasetSetListingQueryOneByOne.java
deleted file mode 100644
index aef32a5f213..00000000000
--- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/datasetlister/DatasetSetListingQueryOneByOne.java
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- * Copyright 2009 ETH Zuerich, CISD
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package ch.systemsx.cisd.openbis.generic.server.business.bo.datasetlister;
-
-import it.unimi.dsi.fastutil.longs.LongIterator;
-import it.unimi.dsi.fastutil.longs.LongSet;
-
-import java.util.Iterator;
-
-import net.lemnik.eodsql.DataIterator;
-
-import ch.rinn.restrictions.Friend;
-import ch.systemsx.cisd.common.exceptions.NotImplementedException;
-
-/**
- * An implementation of {@link IDatasetSetListingQuery} that gets the datasets one by one.
- * 
- * @author Tomasz Pylak
- */
-@Friend(toClasses =
-    { IDatasetListingQuery.class })
-class DatasetSetListingQueryOneByOne implements IDatasetSetListingQuery
-{
-    private final IDatasetListingQuery query;
-
-    public DatasetSetListingQueryOneByOne(final IDatasetListingQuery query)
-    {
-        this.query = query;
-    }
-
-    public Iterable<DatasetRecord> getDatasets(final LongSet datasetIds)
-    {
-        return new Iterable<DatasetRecord>()
-            {
-                public Iterator<DatasetRecord> iterator()
-                {
-                    final LongIterator it = datasetIds.iterator();
-                    return new Iterator<DatasetRecord>()
-                        {
-                            public boolean hasNext()
-                            {
-                                return it.hasNext();
-                            }
-
-                            public DatasetRecord next()
-                            {
-                                return query.getDataset(it.nextLong());
-                            }
-
-                            public void remove() throws UnsupportedOperationException
-                            {
-                                throw new UnsupportedOperationException();
-                            }
-                        };
-                }
-            };
-    }
-
-    // TODO 2009-09-01, Tomasz Pylak: implement me! (h2)
-
-    public DataIterator<Long> getDatasetChildrenIds(LongSet entityIds)
-    {
-        throw new NotImplementedException();
-    }
-
-}
diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/datasetlister/IDatasetListingQuery.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/datasetlister/IDatasetListingQuery.java
index 302db0c806a..03777617d16 100644
--- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/datasetlister/IDatasetListingQuery.java
+++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/datasetlister/IDatasetListingQuery.java
@@ -23,10 +23,7 @@ import net.lemnik.eodsql.TransactionQuery;
 import ch.rinn.restrictions.Friend;
 import ch.rinn.restrictions.Private;
 import ch.systemsx.cisd.openbis.generic.server.business.bo.common.CodeRecord;
-import ch.systemsx.cisd.openbis.generic.server.business.bo.common.GenericEntityPropertyRecord;
 import ch.systemsx.cisd.openbis.generic.server.business.bo.common.IPropertyListingQuery;
-import ch.systemsx.cisd.openbis.generic.server.business.bo.common.MaterialEntityPropertyRecord;
-import ch.systemsx.cisd.openbis.generic.server.business.bo.common.VocabularyTermRecord;
 
 /**
  * A {@link TransactionQuery} interface for obtaining large sets of dataset-related entities from
@@ -101,66 +98,4 @@ public interface IDatasetListingQuery extends TransactionQuery, IPropertyListing
     @Select(sql = "select id, code from locator_types")
     public CodeRecord[] getLocatorTypes();
 
-    // ------------- Properties
-
-    /**
-     * Returns all generic property values of the sample with <var>entityId</var>.
-     */
-    @Select("select pr.ds_id as entity_id, etpt.prty_id, pr.value from data_set_properties pr"
-            + "      join data_set_type_property_types etpt on pr.dstpt_id=etpt.id"
-            + "   where pr.value is not null and pr.ds_id=?{1}")
-    public DataIterator<GenericEntityPropertyRecord> getEntityPropertyGenericValues(long entityId);
-
-    /**
-     * Returns all generic property values of all samples.
-     */
-    @Select(sql = "select pr.ds_id as entity_id, etpt.prty_id, pr.value from data_set_properties pr"
-            + "      join data_set_type_property_types etpt on pr.dstpt_id=etpt.id"
-            + "      join property_types pt on etpt.prty_id=pt.id"
-            + "   where pr.value is not null and pt.dbin_id=?{1}", fetchSize = FETCH_SIZE)
-    public DataIterator<GenericEntityPropertyRecord> getAllEntityPropertyGenericValues(
-            long dbInstanceId);
-
-    /**
-     * Returns all controlled vocabulary property values of the sample with <var>sampleId</var>.
-     */
-    @Select("select pr.ds_id as entity_id, etpt.prty_id, cvte.id, cvte.covo_id, cvte.code, cvte.label"
-            + "      from data_set_properties pr"
-            + "      join data_set_type_property_types etpt on pr.dstpt_id=etpt.id"
-            + "      join controlled_vocabulary_terms cvte on pr.cvte_id=cvte.id"
-            + "   where pr.ds_id=?{1}")
-    public DataIterator<VocabularyTermRecord> getEntityPropertyVocabularyTermValues(long entityId);
-
-    /**
-     * Returns all controlled vocabulary property values of all samples.
-     */
-    @Select(sql = "select pr.ds_id as entity_id, etpt.prty_id, cvte.id, cvte.covo_id, cvte.code, cvte.label"
-            + "      from data_set_properties pr"
-            + "      join data_set_type_property_types etpt on pr.dstpt_id=etpt.id"
-            + "      join controlled_vocabulary_terms cvte on pr.cvte_id=cvte.id"
-            + "      join property_types pt on etpt.prty_id=pt.id"
-            + "    where pt.dbin_id=?{1}        ", fetchSize = FETCH_SIZE)
-    public DataIterator<VocabularyTermRecord> getAllEntityPropertyVocabularyTermValues(
-            long dbInstanceId);
-
-    /**
-     * Returns all material-type property values of the sample with <var>sampleId</var>
-     */
-    @Select("select pr.ds_id as entity_id, etpt.prty_id, m.id, m.code, m.maty_id"
-            + "      from data_set_properties pr"
-            + "      join data_set_type_property_types etpt on pr.dstpt_id=etpt.id"
-            + "      join materials m on pr.mate_prop_id=m.id where pr.ds_id=?{1}")
-    public DataIterator<MaterialEntityPropertyRecord> getEntityPropertyMaterialValues(long entityId);
-
-    /**
-     * Returns all material-type property values of all samples.
-     */
-    @Select(sql = "select pr.ds_id as entity_id, etpt.prty_id, m.id, m.code, m.maty_id"
-            + "      from data_set_properties pr"
-            + "      join data_set_type_property_types etpt on pr.dstpt_id=etpt.id"
-            + "      join materials m on pr.mate_prop_id=m.id"
-            + "      join property_types pt on etpt.prty_id=pt.id"
-            + "    where pt.dbin_id=?{1}    ", fetchSize = FETCH_SIZE)
-    public DataIterator<MaterialEntityPropertyRecord> getAllEntityPropertyMaterialValues(
-            long dbInstanceId);
 }
diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/samplelister/SampleListerDAO.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/samplelister/SampleListerDAO.java
index 1a85fcbb786..ba79984e4ae 100644
--- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/samplelister/SampleListerDAO.java
+++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/samplelister/SampleListerDAO.java
@@ -20,7 +20,6 @@ import it.unimi.dsi.fastutil.longs.LongSet;
 
 import java.sql.Connection;
 
-import net.lemnik.eodsql.DataIterator;
 import net.lemnik.eodsql.QueryTool;
 
 import ch.rinn.restrictions.Friend;
@@ -31,10 +30,7 @@ import ch.systemsx.cisd.openbis.generic.server.business.bo.common.GenericEntityP
 import ch.systemsx.cisd.openbis.generic.server.business.bo.common.IEntityPropertyListingQuery;
 import ch.systemsx.cisd.openbis.generic.server.business.bo.common.IEntityPropertySetListingQuery;
 import ch.systemsx.cisd.openbis.generic.server.business.bo.common.MaterialEntityPropertyRecord;
-import ch.systemsx.cisd.openbis.generic.server.business.bo.common.PropertiesSetListingQueryFallback;
-import ch.systemsx.cisd.openbis.generic.server.business.bo.common.QueryStrategyChooser;
 import ch.systemsx.cisd.openbis.generic.server.business.bo.common.VocabularyTermRecord;
-import ch.systemsx.cisd.openbis.generic.server.business.bo.common.QueryStrategyChooser.IEntitiesCountProvider;
 import ch.systemsx.cisd.openbis.generic.server.dataaccess.IDAOFactory;
 import ch.systemsx.cisd.openbis.generic.server.dataaccess.PersistencyResources;
 import ch.systemsx.cisd.openbis.generic.shared.dto.DatabaseInstancePE;
@@ -75,19 +71,14 @@ public final class SampleListerDAO extends AbstractDAO
 
     private final IEntityPropertySetListingQuery propertySetQuery;
 
-    private final QueryStrategyChooser strategyChooser;
-
     SampleListerDAO(final boolean supportsSetQuery, ISampleListingFullQuery query,
             final DatabaseInstancePE databaseInstance)
     {
         super(databaseInstance);
         this.query = query;
-        this.strategyChooser = createStrategyChooser(query, databaseInstance.getId());
-        this.setQuery =
-                createIdSetQuery(supportsSetQuery, query, strategyChooser, databaseInstance.getId());
+        this.setQuery = createIdSetQuery(supportsSetQuery, query, databaseInstance.getId());
         this.propertySetQuery =
-                createSetPropertyQuery(supportsSetQuery, query, strategyChooser, databaseInstance
-                        .getId());
+                createSetPropertyQuery(supportsSetQuery, query, databaseInstance.getId());
     }
 
     ISampleListingQuery getQuery()
@@ -105,70 +96,10 @@ public final class SampleListerDAO extends AbstractDAO
         return propertySetQuery;
     }
 
-    private static QueryStrategyChooser createStrategyChooser(final ISampleListingFullQuery query,
-            final long databaseInstanceId)
-    {
-        return new QueryStrategyChooser(new IEntitiesCountProvider()
-            {
-                public long count()
-                {
-                    return query.getSampleCount(databaseInstanceId);
-                }
-            });
-    }
-
     private static IEntityPropertySetListingQuery createSetPropertyQuery(boolean supportsSetQuery,
-            ISampleListingFullQuery query, QueryStrategyChooser strategyChooser,
-            final long databaseInstanceId)
+            ISampleListingFullQuery query, final long databaseInstanceId)
     {
-        if (supportsSetQuery)
-        {
-            return asEntityPropertySetListingQuery(query);
-        } else
-        {
-            return new PropertiesSetListingQueryFallback(asEntityPropertyListingQuery(query,
-                    databaseInstanceId), strategyChooser);
-        }
-    }
-
-    private static IEntityPropertyListingQuery asEntityPropertyListingQuery(
-            final ISampleListingFullQuery query, final long databaseInstanceId)
-    {
-        return new IEntityPropertyListingQuery()
-            {
-                public DataIterator<GenericEntityPropertyRecord> getEntityPropertyGenericValues()
-                {
-                    return query.getAllEntityPropertyGenericValues(databaseInstanceId);
-                }
-
-                public DataIterator<GenericEntityPropertyRecord> getEntityPropertyGenericValues(
-                        long entityId)
-                {
-                    return query.getEntityPropertyGenericValues(entityId);
-                }
-
-                public DataIterator<MaterialEntityPropertyRecord> getEntityPropertyMaterialValues()
-                {
-                    return query.getAllEntityPropertyMaterialValues(databaseInstanceId);
-                }
-
-                public DataIterator<MaterialEntityPropertyRecord> getEntityPropertyMaterialValues(
-                        long sampleId)
-                {
-                    return query.getEntityPropertyMaterialValues(sampleId);
-                }
-
-                public DataIterator<VocabularyTermRecord> getEntityPropertyVocabularyTermValues()
-                {
-                    return query.getAllEntityPropertyVocabularyTermValues(databaseInstanceId);
-                }
-
-                public DataIterator<VocabularyTermRecord> getEntityPropertyVocabularyTermValues(
-                        long sampleId)
-                {
-                    return query.getEntityPropertyVocabularyTermValues(sampleId);
-                }
-            };
+        return asEntityPropertySetListingQuery(query);
     }
 
     private static IEntityPropertySetListingQuery asEntityPropertySetListingQuery(
@@ -197,16 +128,9 @@ public final class SampleListerDAO extends AbstractDAO
     }
 
     private static ISampleSetListingQuery createIdSetQuery(boolean supportsSetQuery,
-            ISampleListingFullQuery query, QueryStrategyChooser strategyChooser,
-            final long databaseInstanceId)
+            ISampleListingFullQuery query, final long databaseInstanceId)
     {
-        if (supportsSetQuery)
-        {
-            return asSampleSetListingQuery(query);
-        } else
-        {
-            return new SampleSetListingQueryFallback(query, strategyChooser, databaseInstanceId);
-        }
+        return asSampleSetListingQuery(query);
     }
 
     private static ISampleSetListingQuery asSampleSetListingQuery(
diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/samplelister/SampleSetListingQueryFallback.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/samplelister/SampleSetListingQueryFallback.java
deleted file mode 100644
index 22624c4414f..00000000000
--- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/samplelister/SampleSetListingQueryFallback.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Copyright 2009 ETH Zuerich, CISD
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package ch.systemsx.cisd.openbis.generic.server.business.bo.samplelister;
-
-import it.unimi.dsi.fastutil.longs.LongSet;
-
-import ch.rinn.restrictions.Friend;
-import ch.systemsx.cisd.openbis.generic.server.business.bo.common.QueryStrategyChooser;
-
-/**
- * A fallback implementation of {@link ISampleSetListingQuery} for database engines who don't
- * support querying for identifier sets.
- * 
- * @author Bernd Rinn
- */
-@Friend(toClasses = ISampleListingQuery.class)
-class SampleSetListingQueryFallback implements ISampleSetListingQuery
-{
-    private final ISampleSetListingQuery oneByOneDelegate;
-
-    private final ISampleSetListingQuery fullTableScanDelegate;
-
-    private final QueryStrategyChooser strategyChooser;
-
-    public SampleSetListingQueryFallback(final ISampleListingQuery query,
-            QueryStrategyChooser strategyChooser, long databaseInstanceId)
-    {
-        this.strategyChooser = strategyChooser;
-        this.oneByOneDelegate = new SampleSetListingQueryOneByOne(query);
-        this.fullTableScanDelegate =
-                new SampleSetListingQueryFullTableScan(query, databaseInstanceId);
-    }
-
-    public Iterable<SampleRecord> getSamples(final LongSet sampleIds)
-    {
-        if (strategyChooser.useFullTableScan(sampleIds))
-        {
-            return fullTableScanDelegate.getSamples(sampleIds);
-        } else
-        {
-            return oneByOneDelegate.getSamples(sampleIds);
-        }
-    }
-}
diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/samplelister/SampleSetListingQueryFullTableScan.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/samplelister/SampleSetListingQueryFullTableScan.java
deleted file mode 100644
index c2693dbe487..00000000000
--- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/samplelister/SampleSetListingQueryFullTableScan.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * Copyright 2009 ETH Zuerich, CISD
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package ch.systemsx.cisd.openbis.generic.server.business.bo.samplelister;
-
-import it.unimi.dsi.fastutil.longs.LongSet;
-
-import java.util.Iterator;
-
-import org.apache.commons.collections15.Predicate;
-import org.apache.commons.collections15.iterators.FilterIterator;
-
-import ch.rinn.restrictions.Friend;
-
-/**
- * An implementation of {@link ISampleSetListingQuery} which gets all all rows and then filters them
- * down by sample id. This will be a faster way of getting the samples then getting them one by one
- * (as {@link SampleSetListingQueryOneByOne} does) when a the requested samples are a considerable
- * part of all samples.
- * 
- * @author Bernd Rinn
- */
-@Friend(toClasses =
-    { SampleRecord.class, ISampleListingQuery.class })
-class SampleSetListingQueryFullTableScan implements ISampleSetListingQuery
-{
-    private final long databaseInstanceId;
-
-    private final ISampleListingQuery query;
-
-    public SampleSetListingQueryFullTableScan(final ISampleListingQuery query,
-            final long databaseInstanceId)
-    {
-        this.query = query;
-        this.databaseInstanceId = databaseInstanceId;
-    }
-
-    public Iterable<SampleRecord> getSamples(final LongSet sampleIds)
-    {
-        return new Iterable<SampleRecord>()
-            {
-                public Iterator<SampleRecord> iterator()
-                {
-                    return new FilterIterator<SampleRecord>(query.getSamples(databaseInstanceId),
-                            new Predicate<SampleRecord>()
-                                {
-                                    public boolean evaluate(SampleRecord sample)
-                                    {
-                                        return sampleIds.contains(sample.id);
-                                    }
-                                });
-                }
-            };
-    }
-
-}
diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/samplelister/SampleSetListingQueryOneByOne.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/samplelister/SampleSetListingQueryOneByOne.java
deleted file mode 100644
index be17210e49c..00000000000
--- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/samplelister/SampleSetListingQueryOneByOne.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * Copyright 2009 ETH Zuerich, CISD
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package ch.systemsx.cisd.openbis.generic.server.business.bo.samplelister;
-
-import it.unimi.dsi.fastutil.longs.LongIterator;
-import it.unimi.dsi.fastutil.longs.LongSet;
-
-import java.util.Iterator;
-
-import ch.rinn.restrictions.Friend;
-
-/**
- * An implementation of {@link ISampleSetListingQuery} that gets the samples one by one.
- * 
- * @author Bernd Rinn
- */
-@Friend(toClasses = ISampleListingQuery.class)
-class SampleSetListingQueryOneByOne implements ISampleSetListingQuery
-{
-    private final ISampleListingQuery query;
-
-    public SampleSetListingQueryOneByOne(final ISampleListingQuery query)
-    {
-        this.query = query;
-    }
-
-    public Iterable<SampleRecord> getSamples(final LongSet sampleIds)
-    {
-        return new Iterable<SampleRecord>()
-            {
-                public Iterator<SampleRecord> iterator()
-                {
-                    final LongIterator it = sampleIds.iterator();
-                    return new Iterator<SampleRecord>()
-                        {
-                            public boolean hasNext()
-                            {
-                                return it.hasNext();
-                            }
-
-                            public SampleRecord next()
-                            {
-                                return query.getSample(it.nextLong());
-                            }
-
-                            public void remove() throws UnsupportedOperationException
-                            {
-                                throw new UnsupportedOperationException();
-                            }
-                        };
-                }
-            };
-    }
-
-}
diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/h2/SampleCodeUniquenessCheckTrigger.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/h2/SampleCodeUniquenessCheckTrigger.java
deleted file mode 100644
index 042f983598d..00000000000
--- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/h2/SampleCodeUniquenessCheckTrigger.java
+++ /dev/null
@@ -1,195 +0,0 @@
-/*
- * Copyright 2009 ETH Zuerich, CISD
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package ch.systemsx.cisd.openbis.generic.server.dataaccess.db.h2;
-
-import java.sql.Connection;
-import java.sql.ResultSet;
-import java.sql.SQLException;
-import java.sql.Types;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Map;
-
-import org.h2.api.Trigger;
-
-import ch.systemsx.cisd.common.db.SQLStateUtils;
-
-/**
- * A trigger to check the uniqueness of the sample code in the SAMPLES table.
- * 
- * @author Bernd Rinn
- */
-public class SampleCodeUniquenessCheckTrigger implements Trigger
-{
-    private static final String GROU_ID = "GROU_ID";
-
-    private static final String ID = "ID";
-
-    private static final String CODE = "CODE";
-
-    private static final String DBIN_ID = "DBIN_ID";
-
-    private static final String SAMP_ID_PART_OF = "SAMP_ID_PART_OF";
-
-    private final Map<String, Integer> nameToIdxMap = new HashMap<String, Integer>();
-
-    private Class<?>[] columnClasses;
-
-    public void init(Connection conn, String schemaName, String triggerName, String tableName,
-            boolean before, int type) throws SQLException
-    {
-        final ResultSet columns = conn.getMetaData().getColumns(null, schemaName, tableName, null);
-        final ArrayList<String> columnNames = new ArrayList<String>();
-        final ArrayList<Class<?>> columnClassesList = new ArrayList<Class<?>>();
-        while (columns.next())
-        {
-            columnNames.add(columns.getString("COLUMN_NAME"));
-            int dbType = columns.getInt("DATA_TYPE");
-            switch (dbType)
-            {
-                case Types.INTEGER:
-                    columnClassesList.add(Integer.class);
-                    break;
-                case Types.BIGINT:
-                    columnClassesList.add(Long.class);
-                    break;
-                case Types.FLOAT:
-                    columnClassesList.add(Float.class);
-                    break;
-                case Types.DOUBLE:
-                case Types.REAL:
-                    columnClassesList.add(Double.class);
-                    break;
-                case Types.DATE:
-                case Types.TIME:
-                case Types.TIMESTAMP:
-                    columnClassesList.add(java.sql.Date.class);
-                    break;
-                case Types.VARCHAR:
-                case Types.LONGVARCHAR:
-                    columnClassesList.add(String.class);
-                    break;
-                default:
-                    throw new SQLException("Unexpected Types constant");
-            }
-        }
-        columnClasses = new Class[columnClassesList.size()];
-        columnClassesList.toArray(columnClasses);
-        int idx = 0;
-        for (String columnName : columnNames)
-        {
-            nameToIdxMap.put(columnName, idx++);
-        }
-        if (columnClasses[nameToIdxMap.get(SAMP_ID_PART_OF)] != Long.class)
-        {
-            throw new SQLException("Unexpected column type");
-        }
-    }
-
-    private Long getLong(Object[] row, String colName)
-    {
-        return (Long) row[nameToIdxMap.get(colName)];
-    }
-
-    private String getString(Object[] row, String colName)
-    {
-        return (String) row[nameToIdxMap.get(colName)];
-    }
-
-    private int getQueryResult(Connection conn, String query) throws SQLException
-    {
-        final ResultSet rs = conn.createStatement().executeQuery(query);
-        rs.next();
-        final int result = rs.getInt(1);
-        rs.close();
-        return result;
-    }
-
-    public void fire(Connection conn, Object[] oldRow, Object[] newRow) throws SQLException
-    {
-        final long id = getLong(newRow, ID);
-        final String code = getString(newRow, CODE);
-        final Long dbinId = getLong(newRow, DBIN_ID);
-        final Long groupId = getLong(newRow, GROU_ID);
-        final Long sampIdPartOf = getLong(newRow, SAMP_ID_PART_OF);
-        if (sampIdPartOf == null)
-        {
-            if (dbinId != null)
-            {
-                final int count =
-                        getQueryResult(conn, String.format("SELECT count(*) FROM SAMPLES "
-                                + "WHERE id != %d and code = '%s' and "
-                                + "samp_id_part_of is NULL and dbin_id = %d", id, code, dbinId));
-                if (count > 0)
-                {
-                    throw new SQLException(
-                            "Insert/Update of Sample (Code: "
-                                    + code
-                                    + ") failed because database instance sample with the same code already exists.",
-                            SQLStateUtils.UNIQUE_VIOLATION);
-                }
-            } else
-            {
-                final int count =
-                        getQueryResult(conn, String
-                                .format("SELECT count(*) FROM SAMPLES "
-                                        + "WHERE id != %d and code = '%s' and "
-                                        + "samp_id_part_of is NULL and grou_id = %d", id, code,
-                                        groupId));
-                if (count > 0)
-                {
-                    throw new SQLException(
-                            "Insert/Update of Sample (Code: "
-                                    + code
-                                    + ") failed because group sample with the same code already exists.",
-                            SQLStateUtils.UNIQUE_VIOLATION);
-                }
-            }
-        } else
-        {
-            if (dbinId != null)
-            {
-                final int count =
-                        getQueryResult(conn, String.format("SELECT count(*) FROM SAMPLES "
-                                + "where id != %d and code = %s and "
-                                + "samp_id_part_of = %d and dbin_id = %d", id, code,
-                                sampIdPartOf, dbinId));
-                if (count > 0)
-                {
-                    throw new SQLException("Insert/Update of Sample (Code: " + code
-                            + ") failed because database instance sample with the same code "
-                            + "and being the part of the same parent already exists.",
-                            SQLStateUtils.UNIQUE_VIOLATION);
-                }
-            } else
-            {
-                final int count =
-                        getQueryResult(conn, String.format("SELECT count(*) FROM SAMPLES "
-                                + "where id != %d and code = %s and "
-                                + "samp_id_part_of = %d and grou_id = %d", id, code,
-                                sampIdPartOf, groupId));
-                if (count > 0)
-                {
-                    throw new SQLException("Insert/Update of Sample (Code: " + code
-                            + ") failed because group sample with the same code "
-                            + "and being the part of the same parent already exists.",
-                            SQLStateUtils.UNIQUE_VIOLATION);
-                }
-            }
-        }
-    }
-}
diff --git a/openbis/source/java/service.properties b/openbis/source/java/service.properties
index ef1e1595be4..24e191cac09 100644
--- a/openbis/source/java/service.properties
+++ b/openbis/source/java/service.properties
@@ -9,7 +9,7 @@ authorization-component-factory = active-authorization
 
 script-folder = ./source/
 
-# Supported: currently only 'postgresql' and 'h2' are supported
+# Supported: currently only 'postgresql' is supported
 database.engine = postgresql
 database.create-from-scratch = false
 # For debugging set this value to true.
diff --git a/openbis/source/sql/h2/039/domains-039.sql b/openbis/source/sql/h2/039/domains-039.sql
deleted file mode 100644
index 97157b98f17..00000000000
--- a/openbis/source/sql/h2/039/domains-039.sql
+++ /dev/null
@@ -1,20 +0,0 @@
--- Creating domains
-
-CREATE DOMAIN AUTHORIZATION_ROLE AS VARCHAR(40) CHECK (VALUE IN ('ADMIN', 'POWER_USER', 'USER', 'OBSERVER', 'ETL_SERVER'));
-CREATE DOMAIN BOOLEAN_CHAR AS BOOLEAN DEFAULT FALSE;
-CREATE DOMAIN BOOLEAN_CHAR_OR_UNKNOWN AS CHAR(1) DEFAULT 'U' CHECK (VALUE IN ('F', 'T', 'U'));
-CREATE DOMAIN CODE AS VARCHAR(40);
-CREATE DOMAIN COLUMN_LABEL AS VARCHAR(100);
-CREATE DOMAIN DATA_STORE_SERVICE_KIND AS VARCHAR(40) CHECK (VALUE IN ('PROCESSING', 'QUERIES'));
-CREATE DOMAIN DESCRIPTION_1000 AS VARCHAR(1000);
-CREATE DOMAIN EVENT_TYPE AS VARCHAR(40) CHECK (VALUE IN ('DELETION', 'INVALIDATION', 'MOVEMENT'));
-CREATE DOMAIN FILE AS BYTEA;
-CREATE DOMAIN FILE_NAME AS VARCHAR(100);
-CREATE DOMAIN GENERIC_VALUE AS VARCHAR(1024);
-CREATE DOMAIN OBJECT_NAME AS VARCHAR(50);
-CREATE DOMAIN REAL_VALUE AS REAL;
-CREATE DOMAIN TECH_ID AS BIGINT;
-CREATE DOMAIN TIME_STAMP AS TIMESTAMP;
-CREATE DOMAIN TIME_STAMP_DFL AS TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP;
-CREATE DOMAIN USER_ID AS VARCHAR(50);
-CREATE DOMAIN TITLE_100 AS VARCHAR(100);
\ No newline at end of file
diff --git a/openbis/source/sql/h2/039/function-039.sql b/openbis/source/sql/h2/039/function-039.sql
deleted file mode 100644
index 555f49b5b29..00000000000
--- a/openbis/source/sql/h2/039/function-039.sql
+++ /dev/null
@@ -1,7 +0,0 @@
--- Creating Functions
-
-------------------------------------------------------------------------------------
---  Purpose:  Create trigger SAMPLE_CODE_UNIQUENESS_CHECK 
-------------------------------------------------------------------------------------
-CREATE TRIGGER SAMPLE_CODE_UNIQUENESS_CHECK_INS BEFORE INSERT ON SAMPLES FOR EACH ROW CALL "ch.systemsx.cisd.openbis.generic.server.dataaccess.db.h2.SampleCodeUniquenessCheckTrigger";
-CREATE TRIGGER SAMPLE_CODE_UNIQUENESS_CHECK_UPD BEFORE UPDATE ON SAMPLES FOR EACH ROW CALL "ch.systemsx.cisd.openbis.generic.server.dataaccess.db.h2.SampleCodeUniquenessCheckTrigger";
\ No newline at end of file
diff --git a/openbis/source/sql/h2/040/domains-040.sql b/openbis/source/sql/h2/040/domains-040.sql
deleted file mode 100644
index 97157b98f17..00000000000
--- a/openbis/source/sql/h2/040/domains-040.sql
+++ /dev/null
@@ -1,20 +0,0 @@
--- Creating domains
-
-CREATE DOMAIN AUTHORIZATION_ROLE AS VARCHAR(40) CHECK (VALUE IN ('ADMIN', 'POWER_USER', 'USER', 'OBSERVER', 'ETL_SERVER'));
-CREATE DOMAIN BOOLEAN_CHAR AS BOOLEAN DEFAULT FALSE;
-CREATE DOMAIN BOOLEAN_CHAR_OR_UNKNOWN AS CHAR(1) DEFAULT 'U' CHECK (VALUE IN ('F', 'T', 'U'));
-CREATE DOMAIN CODE AS VARCHAR(40);
-CREATE DOMAIN COLUMN_LABEL AS VARCHAR(100);
-CREATE DOMAIN DATA_STORE_SERVICE_KIND AS VARCHAR(40) CHECK (VALUE IN ('PROCESSING', 'QUERIES'));
-CREATE DOMAIN DESCRIPTION_1000 AS VARCHAR(1000);
-CREATE DOMAIN EVENT_TYPE AS VARCHAR(40) CHECK (VALUE IN ('DELETION', 'INVALIDATION', 'MOVEMENT'));
-CREATE DOMAIN FILE AS BYTEA;
-CREATE DOMAIN FILE_NAME AS VARCHAR(100);
-CREATE DOMAIN GENERIC_VALUE AS VARCHAR(1024);
-CREATE DOMAIN OBJECT_NAME AS VARCHAR(50);
-CREATE DOMAIN REAL_VALUE AS REAL;
-CREATE DOMAIN TECH_ID AS BIGINT;
-CREATE DOMAIN TIME_STAMP AS TIMESTAMP;
-CREATE DOMAIN TIME_STAMP_DFL AS TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP;
-CREATE DOMAIN USER_ID AS VARCHAR(50);
-CREATE DOMAIN TITLE_100 AS VARCHAR(100);
\ No newline at end of file
diff --git a/openbis/source/sql/h2/040/function-040.sql b/openbis/source/sql/h2/040/function-040.sql
deleted file mode 100644
index 555f49b5b29..00000000000
--- a/openbis/source/sql/h2/040/function-040.sql
+++ /dev/null
@@ -1,7 +0,0 @@
--- Creating Functions
-
-------------------------------------------------------------------------------------
---  Purpose:  Create trigger SAMPLE_CODE_UNIQUENESS_CHECK 
-------------------------------------------------------------------------------------
-CREATE TRIGGER SAMPLE_CODE_UNIQUENESS_CHECK_INS BEFORE INSERT ON SAMPLES FOR EACH ROW CALL "ch.systemsx.cisd.openbis.generic.server.dataaccess.db.h2.SampleCodeUniquenessCheckTrigger";
-CREATE TRIGGER SAMPLE_CODE_UNIQUENESS_CHECK_UPD BEFORE UPDATE ON SAMPLES FOR EACH ROW CALL "ch.systemsx.cisd.openbis.generic.server.dataaccess.db.h2.SampleCodeUniquenessCheckTrigger";
\ No newline at end of file
diff --git a/openbis/source/sql/h2/041/domains-041.sql b/openbis/source/sql/h2/041/domains-041.sql
deleted file mode 100644
index 97157b98f17..00000000000
--- a/openbis/source/sql/h2/041/domains-041.sql
+++ /dev/null
@@ -1,20 +0,0 @@
--- Creating domains
-
-CREATE DOMAIN AUTHORIZATION_ROLE AS VARCHAR(40) CHECK (VALUE IN ('ADMIN', 'POWER_USER', 'USER', 'OBSERVER', 'ETL_SERVER'));
-CREATE DOMAIN BOOLEAN_CHAR AS BOOLEAN DEFAULT FALSE;
-CREATE DOMAIN BOOLEAN_CHAR_OR_UNKNOWN AS CHAR(1) DEFAULT 'U' CHECK (VALUE IN ('F', 'T', 'U'));
-CREATE DOMAIN CODE AS VARCHAR(40);
-CREATE DOMAIN COLUMN_LABEL AS VARCHAR(100);
-CREATE DOMAIN DATA_STORE_SERVICE_KIND AS VARCHAR(40) CHECK (VALUE IN ('PROCESSING', 'QUERIES'));
-CREATE DOMAIN DESCRIPTION_1000 AS VARCHAR(1000);
-CREATE DOMAIN EVENT_TYPE AS VARCHAR(40) CHECK (VALUE IN ('DELETION', 'INVALIDATION', 'MOVEMENT'));
-CREATE DOMAIN FILE AS BYTEA;
-CREATE DOMAIN FILE_NAME AS VARCHAR(100);
-CREATE DOMAIN GENERIC_VALUE AS VARCHAR(1024);
-CREATE DOMAIN OBJECT_NAME AS VARCHAR(50);
-CREATE DOMAIN REAL_VALUE AS REAL;
-CREATE DOMAIN TECH_ID AS BIGINT;
-CREATE DOMAIN TIME_STAMP AS TIMESTAMP;
-CREATE DOMAIN TIME_STAMP_DFL AS TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP;
-CREATE DOMAIN USER_ID AS VARCHAR(50);
-CREATE DOMAIN TITLE_100 AS VARCHAR(100);
\ No newline at end of file
diff --git a/openbis/source/sql/h2/041/function-041.sql b/openbis/source/sql/h2/041/function-041.sql
deleted file mode 100644
index 555f49b5b29..00000000000
--- a/openbis/source/sql/h2/041/function-041.sql
+++ /dev/null
@@ -1,7 +0,0 @@
--- Creating Functions
-
-------------------------------------------------------------------------------------
---  Purpose:  Create trigger SAMPLE_CODE_UNIQUENESS_CHECK 
-------------------------------------------------------------------------------------
-CREATE TRIGGER SAMPLE_CODE_UNIQUENESS_CHECK_INS BEFORE INSERT ON SAMPLES FOR EACH ROW CALL "ch.systemsx.cisd.openbis.generic.server.dataaccess.db.h2.SampleCodeUniquenessCheckTrigger";
-CREATE TRIGGER SAMPLE_CODE_UNIQUENESS_CHECK_UPD BEFORE UPDATE ON SAMPLES FOR EACH ROW CALL "ch.systemsx.cisd.openbis.generic.server.dataaccess.db.h2.SampleCodeUniquenessCheckTrigger";
\ No newline at end of file
diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/business/bo/datasetlister/DatasetListingQueryTest.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/business/bo/datasetlister/DatasetListingQueryTest.java
index 6bf58fc77b5..0d22de2ad5c 100644
--- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/business/bo/datasetlister/DatasetListingQueryTest.java
+++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/business/bo/datasetlister/DatasetListingQueryTest.java
@@ -27,26 +27,19 @@ import java.util.Arrays;
 import java.util.List;
 import java.util.Set;
 
-import net.lemnik.eodsql.DataIterator;
-
 import org.apache.commons.lang.builder.EqualsBuilder;
 import org.testng.annotations.AfterClass;
 import org.testng.annotations.BeforeClass;
 import org.testng.annotations.Test;
 
 import ch.rinn.restrictions.Friend;
-import ch.systemsx.cisd.openbis.generic.server.business.bo.common.BaseEntityPropertyRecord;
 import ch.systemsx.cisd.openbis.generic.server.business.bo.common.CodeRecord;
 import ch.systemsx.cisd.openbis.generic.server.business.bo.common.EntityListingTestUtils;
-import ch.systemsx.cisd.openbis.generic.server.business.bo.common.GenericEntityPropertyRecord;
-import ch.systemsx.cisd.openbis.generic.server.business.bo.common.MaterialEntityPropertyRecord;
-import ch.systemsx.cisd.openbis.generic.server.business.bo.common.VocabularyTermRecord;
 import ch.systemsx.cisd.openbis.generic.server.business.bo.common.entity.ExperimentProjectGroupCodeRecord;
 import ch.systemsx.cisd.openbis.generic.server.business.bo.samplelister.ISampleListingQuery;
 import ch.systemsx.cisd.openbis.generic.server.dataaccess.IDAOFactory;
 import ch.systemsx.cisd.openbis.generic.server.dataaccess.db.AbstractDAOTest;
 import ch.systemsx.cisd.openbis.generic.shared.basic.dto.DatabaseInstance;
-import ch.systemsx.cisd.openbis.generic.shared.basic.dto.PropertyType;
 import ch.systemsx.cisd.openbis.generic.shared.dto.DatabaseInstancePE;
 import ch.systemsx.cisd.openbis.generic.shared.dto.ExperimentPE;
 import ch.systemsx.cisd.openbis.generic.shared.dto.GroupPE;
@@ -243,78 +236,4 @@ public class DatasetListingQueryTest extends AbstractDAOTest
         findCode(Arrays.asList(codes), "XML");
     }
 
-    // ------------------------
-
-    private void assertCorrectEntityAndPropertyTypeReferences(
-            List<? extends BaseEntityPropertyRecord> properties)
-    {
-        DataIterator<DatasetRecord> entities = query.getDatasets(dbInstanceId);
-        PropertyType[] propertyTypes = query.getPropertyTypes();
-        EntityListingTestUtils.assertCorrectEntityAndPropertyTypeReferences(entities, properties,
-                propertyTypes);
-    }
-
-    @Test
-    public void testEntityPropertiesGenericValues()
-    {
-        List<GenericEntityPropertyRecord> properties =
-                asList(query.getAllEntityPropertyGenericValues(dbInstanceId));
-        assertCorrectEntityAndPropertyTypeReferences(properties);
-        for (GenericEntityPropertyRecord property : properties)
-        {
-            assertNotNull(property.value);
-        }
-        checkEntityPropertiesGenericValuesForEntity(EntityListingTestUtils
-                .getAnyEntityId(properties));
-    }
-
-    // entityId - id of an entity which has a property
-    private void checkEntityPropertiesGenericValuesForEntity(long entityId)
-    {
-        DataIterator<GenericEntityPropertyRecord> properties =
-                query.getEntityPropertyGenericValues(entityId);
-        EntityListingTestUtils.checkPropertiesGenericValues(entityId, properties);
-    }
-
-    @Test
-    public void testEntityPropertiesMaterialValues()
-    {
-        List<MaterialEntityPropertyRecord> properties =
-                asList(query.getAllEntityPropertyMaterialValues(dbInstanceId));
-        assertCorrectEntityAndPropertyTypeReferences(properties);
-        for (MaterialEntityPropertyRecord property : properties)
-        {
-            assertNotNull(property.code);
-        }
-        checkEntityPropertiesMaterialValuesForEntity(EntityListingTestUtils
-                .getAnyEntityId(properties));
-    }
-
-    private void checkEntityPropertiesMaterialValuesForEntity(long entityId)
-    {
-        DataIterator<MaterialEntityPropertyRecord> properties =
-                query.getEntityPropertyMaterialValues(entityId);
-        EntityListingTestUtils.checkPropertiesMaterialValues(entityId, properties);
-    }
-
-    @Test
-    public void testEntityPropertiesVocabularyTermValues()
-    {
-        List<VocabularyTermRecord> properties =
-                asList(query.getAllEntityPropertyVocabularyTermValues(dbInstanceId));
-        assertCorrectEntityAndPropertyTypeReferences(properties);
-        for (VocabularyTermRecord property : properties)
-        {
-            assertNotNull(property.code);
-        }
-        checkEntityPropertiesVocabularyTermValuesForEntity(EntityListingTestUtils
-                .getAnyEntityId(properties));
-    }
-
-    private void checkEntityPropertiesVocabularyTermValuesForEntity(long entityId)
-    {
-        DataIterator<VocabularyTermRecord> properties =
-                query.getEntityPropertyVocabularyTermValues(entityId);
-        EntityListingTestUtils.checkPropertiesVocabularyTermValues(entityId, properties);
-    }
 }
\ No newline at end of file
diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/AbstractDAOTest.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/AbstractDAOTest.java
index 31f4b0c3b20..4b85b5961a4 100644
--- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/AbstractDAOTest.java
+++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/AbstractDAOTest.java
@@ -87,7 +87,6 @@ public abstract class AbstractDAOTest extends AbstractTransactionalTestNGSpringC
         System.setProperty("hibernate.search.index-base", LUCENE_INDEX_PATH);
         System.setProperty("hibernate.search.worker.execution", "sync");
         System.setProperty("mass-upload-folder", "sourceTest/sql/postgresql");
-        //System.setProperty("database.engine", "h2");
     }
 
     static final Long ANOTHER_DATABASE_INSTANCE_ID = new Long(2);
-- 
GitLab