diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/AbstractBusinessObjectFactory.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/AbstractBusinessObjectFactory.java
index d80d319cb59dfc8d5327450ce37721257baab811..29456d040b9ee0744c88305f2c66c99136c7773e 100644
--- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/AbstractBusinessObjectFactory.java
+++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/AbstractBusinessObjectFactory.java
@@ -103,7 +103,7 @@ public abstract class AbstractBusinessObjectFactory
     }
 
     /**
-     * Returns the entity resolver query.
+     * Returns the entity resolver.
      */
     public IEntityResolverQuery getEntityResolver()
     {
diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/ICommonBusinessObjectFactory.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/ICommonBusinessObjectFactory.java
index 894ac6b222106425727a9f26cd114ef1d5c150c3..487489adc49870c7bdc4db1e418801796c4b3a4e 100644
--- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/ICommonBusinessObjectFactory.java
+++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/ICommonBusinessObjectFactory.java
@@ -18,6 +18,7 @@ package ch.systemsx.cisd.openbis.generic.server.business.bo;
 
 import ch.systemsx.cisd.openbis.generic.server.business.bo.datasetlister.IDatasetLister;
 import ch.systemsx.cisd.openbis.generic.server.business.bo.samplelister.ISampleLister;
+import ch.systemsx.cisd.openbis.generic.server.dataaccess.db.IEntityResolverQuery;
 import ch.systemsx.cisd.openbis.generic.server.jython.api.v1.impl.IMasterDataScriptRegistrationRunner;
 import ch.systemsx.cisd.openbis.generic.shared.dto.Session;
 import ch.systemsx.cisd.openbis.generic.shared.dto.properties.EntityKind;
@@ -92,4 +93,10 @@ public interface ICommonBusinessObjectFactory extends IAbstractBussinessObjectFa
     public IDatasetLister createDatasetLister(Session session, Long userId);
 
     public IMetaprojectBO createMetaprojectBO(Session session);
+
+    /**
+     * Returns the entity resolver.
+     */
+    public IEntityResolverQuery getEntityResolver();
+
 }
diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/IEntityResolverQuery.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/IEntityResolverQuery.java
index b3c7058378f6f69833da4371b2df3331fcc31378..54ed03cbe1ebb422c49b7679a5d674aae94d9522 100644
--- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/IEntityResolverQuery.java
+++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/IEntityResolverQuery.java
@@ -30,55 +30,55 @@ public interface IEntityResolverQuery extends BaseQuery
      * Returns the tech id of a dataset by its code / perm id.
      */
     @Select(sql = "select d.id from data d where d.code = ?{1}")
-    public long resolveDatasetIdByCode(String datasetCode);
+    public Long tryResolveDatasetIdByCode(String datasetCode);
 
     /**
      * Returns the tech id of a sample by its perm id.
      */
     @Select(sql = "select s.id from samples s where s.perm_id = ?{1}")
-    public long resolveSampleIdByPermId(String permId);
+    public Long tryResolveSampleIdByPermId(String permId);
 
     /**
      * Returns the tech id of a sample by its space and sample code.
      */
     @Select(sql = "select s.id from samples s left join spaces sp on s.space_id = sp.id where sp.code = ?{1} and s.code = ?{2}")
-    public long resolveSampleIdByCode(String spaceCodeOrNull, String sampleCode);
+    public Long tryResolveSampleIdByCode(String spaceCodeOrNull, String sampleCode);
 
     /**
      * Returns the tech id of a material by its code / perm id.
      */
     @Select(sql = "select m.id from materials m left join material_types mt on m.maty_id = mt.id where mt.code = ?{1} and m.code = ?{2}")
-    public long resolveMaterialIdByCode(String materialTypeCode, String materialCode);
+    public Long tryResolveMaterialIdByCode(String materialTypeCode, String materialCode);
 
     /**
      * Returns the tech id of an experiment by its perm id.
      */
     @Select(sql = "select e.id from experiments e where e.perm_id = ?{1}")
-    public long resolveExperimentIdByPermId(String permId);
+    public Long tryResolveExperimentIdByPermId(String permId);
 
     /**
      * Returns the tech id of an experiment by its space, project and experiment code.
      */
     @Select(sql = "select e.id from experiments e left join projects p on e.proj_id = p.id left join spaces sp on p.space_id = sp.id where sp.code = ?{1} and p.code = ?{2} and e.code = ?{3}")
-    public long resolveExperimentIdByCode(String spaceCode, String projectCode,
+    public Long tryResolveExperimentIdByCode(String spaceCode, String projectCode,
             String experimentCode);
 
     /**
      * Returns the tech id of a project by its perm id.
      */
     @Select(sql = "select p.id from projects p where p.perm_id = ?{1}")
-    public long resolveProjectIdByPermId(String permId);
+    public Long tryResolveProjectIdByPermId(String permId);
 
     /**
      * Returns the tech id of a project by its space and project code.
      */
     @Select(sql = "select p.id from projects p left join spaces sp on p.space_id = sp.id where sp.code = ?{1} and p.code = ?{2}")
-    public long resolveProjectIdByCode(String spaceCode, String projectCode);
+    public Long tryResolveProjectIdByCode(String spaceCode, String projectCode);
 
     /**
      * Returns the tech id of a space by its code.
      */
     @Select(sql = "select sp.id from spaces sp where sp.code = ?{1}")
-    public long resolveSpaceIdByCode(String spaceCode);
+    public Long tryResolveSpaceIdByCode(String spaceCode);
 
 }
diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/EntityResolverQueryTest.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/EntityResolverQueryTest.java
index da3bc96423fb6f0ff5504281e8b40e1b596ab6b7..b2d645617b7c8b92866bacc431b799ab4c2d71a3 100644
--- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/EntityResolverQueryTest.java
+++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/EntityResolverQueryTest.java
@@ -17,6 +17,7 @@
 package ch.systemsx.cisd.openbis.generic.server.dataaccess.db;
 
 import static org.testng.AssertJUnit.assertEquals;
+import static org.testng.AssertJUnit.assertNull;
 
 import java.sql.SQLException;
 
@@ -43,59 +44,65 @@ public class EntityResolverQueryTest extends AbstractDAOTest
     @Test
     public void testResolveSpace()
     {
-        assertEquals(1, query.resolveSpaceIdByCode("CISD"));
+        assertEquals(new Long(1), query.tryResolveSpaceIdByCode("CISD"));
     }
 
     @Test
     public void testResolveProjectByCode()
     {
-        assertEquals(5, query.resolveProjectIdByCode("TEST-SPACE", "TEST-PROJECT"));
+        assertEquals(new Long(5), query.tryResolveProjectIdByCode("TEST-SPACE", "TEST-PROJECT"));
     }
 
     @Test
     public void testResolveProjectByPermId()
     {
-        assertEquals(4, query.resolveProjectIdByPermId("20120814110011738-104"));
+        assertEquals(new Long(4), query.tryResolveProjectIdByPermId("20120814110011738-104"));
     }
 
     @Test
     public void testResolveExperimentByCode()
     {
-        assertEquals(23,
-                query.resolveExperimentIdByCode("TEST-SPACE", "TEST-PROJECT", "EXP-SPACE-TEST"));
+        assertEquals(new Long(23),
+                query.tryResolveExperimentIdByCode("TEST-SPACE", "TEST-PROJECT", "EXP-SPACE-TEST"));
     }
 
     @Test
     public void testResolveExperimentByPermId()
     {
-        assertEquals(8, query.resolveExperimentIdByPermId("200811050940555-1032"));
+        assertEquals(new Long(8), query.tryResolveExperimentIdByPermId("200811050940555-1032"));
     }
 
     @Test
     public void testResolveSampleByCode()
     {
-        assertEquals(1054,
-                query.resolveSampleIdByCode("TEST-SPACE", "FV-TEST"));
+        assertEquals(new Long(1054),
+                query.tryResolveSampleIdByCode("TEST-SPACE", "FV-TEST"));
     }
 
     @Test
     public void testResolveSampleByPermId()
     {
-        assertEquals(1019, query.resolveSampleIdByPermId("200811050929035-1014"));
+        assertEquals(new Long(1019), query.tryResolveSampleIdByPermId("200811050929035-1014"));
     }
 
     @Test
     public void testResolveMaterialByCode()
     {
-        assertEquals(36,
-                query.resolveMaterialIdByCode("GENE", "MYGENE1"));
+        assertEquals(new Long(36),
+                query.tryResolveMaterialIdByCode("GENE", "MYGENE1"));
     }
 
     @Test
     public void testResolveDatasetByCode()
     {
-        assertEquals(13,
-                query.resolveDatasetIdByCode("20110509092359990-10"));
+        assertEquals(new Long(13),
+                query.tryResolveDatasetIdByCode("20110509092359990-10"));
+    }
+
+    @Test
+    public void testResolveNonExistentDatasetByCode()
+    {
+        assertNull(query.tryResolveDatasetIdByCode("NONEXISTENT"));
     }
 
 }