From 08a3d5958e99e26366a6f04da729cf9ec7313b82 Mon Sep 17 00:00:00 2001
From: juanf <juanf>
Date: Thu, 7 Sep 2017 07:57:19 +0000
Subject: [PATCH] SSDM-5553 : Reverting to the old unused count version

SVN: 38704
---
 .../generic/server/api/v1/GeneralInformationService.java  | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/api/v1/GeneralInformationService.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/api/v1/GeneralInformationService.java
index 5dc1717a428..5622a3c78f9 100644
--- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/api/v1/GeneralInformationService.java
+++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/api/v1/GeneralInformationService.java
@@ -1391,14 +1391,8 @@ public class GeneralInformationService extends AbstractServer<IGeneralInformatio
         querySampleTypeId.setParameter("sampleTypeCode", sampleTypeCode);
         int sampleTypeId = ((Number) querySampleTypeId.uniqueResult()).intValue();
 
-        SQLQuery querySampleTypePrefix = currentSession.createSQLQuery("SELECT generated_code_prefix from sample_types WHERE code = :sampleTypeCode");
-        querySampleTypePrefix.setParameter("sampleTypeCode", sampleTypeCode);
-        String sampleTypePrefix = ((String) querySampleTypePrefix.uniqueResult());
-
-        SQLQuery querySampleCount =
-                currentSession.createSQLQuery("SELECT COUNT(*) FROM samples_all WHERE saty_id = :sampleTypeId AND code ~ :codePattern");
+        SQLQuery querySampleCount = currentSession.createSQLQuery("SELECT COUNT(*) FROM samples_all WHERE saty_id = :sampleTypeId");
         querySampleCount.setParameter("sampleTypeId", sampleTypeId);
-        querySampleCount.setParameter("codePattern", "^" + sampleTypePrefix + "[0-9]+$");
         long sampleCount = ((Number) querySampleCount.uniqueResult()).longValue();
 
         return sampleCount;
-- 
GitLab