[Add Payment] Fixes multiple requests in count method
authorEduardo Argal Guibert <eduardo.argal@openbravo.com>
Thu, 19 Jun 2014 10:19:19 +0200
changeset 23839 855e52dc0e16
parent 23838 2fc1f1561afa
child 23840 6cb454446dc2
[Add Payment] Fixes multiple requests in count method
modules/org.openbravo.service.datasource/src/org/openbravo/service/datasource/HQLDataSourceService.java
--- a/modules/org.openbravo.service.datasource/src/org/openbravo/service/datasource/HQLDataSourceService.java	Wed Jun 18 19:29:16 2014 +0200
+++ b/modules/org.openbravo.service.datasource/src/org/openbravo/service/datasource/HQLDataSourceService.java	Thu Jun 19 10:19:19 2014 +0200
@@ -126,14 +126,14 @@
   @Override
   protected int getCount(Map<String, String> parameters) {
     Table table = getTableFromParameters(parameters);
-    boolean justCount = true;
+    boolean justCount = false;
     Query countQuery = getQuery(table, parameters, justCount);
     int nRows = -1;
     ScrollableResults scrollableResults = countQuery.scroll();
     if (scrollableResults.last()) {
       nRows = scrollableResults.getRowNumber();
-      scrollableResults.close();
     }
+    scrollableResults.close();
     return nRows + 1;
   }