Package com.scooterframework.orm.activerecord

Examples of com.scooterframework.orm.activerecord.TableGateway


            // count records
            Map<String, Object> inputs = ActiveRecordUtil.getGateway(modelClass).constructFindSQL((String)null, (Map<String, Object>)null, inputOptions);
            String findSQL = (String)inputs.get(ActiveRecordConstants.key_finder_sql);
            String selectCountSQL = "SELECT count(*) total FROM (" + findSQL + ") xxx";
           
            TableGateway tg = ActiveRecordUtil.getGateway(modelClass);
            Object total = null;
            Object cacheKey = null;
            if (tg.getModelCacheClient().useCache("countTotalRecords")) {
              cacheKey = tg.getModelCacheClient().getCacheKey("countTotalRecords", selectCountSQL);
              total = tg.getModelCacheClient().getCache().get(cacheKey);
              if (total != null) return Util.getSafeIntValue(total);
            }
           
            total = SqlServiceClient.retrieveObjectBySQL(selectCountSQL, inputs);
           
            if (tg.getModelCacheClient().useCache("countTotalRecords")) {
              tg.getModelCacheClient().getCache().put(cacheKey, total);
      }
           
            totalRecords = Util.getSafeIntValue(total);
        }
        catch (Exception ex) {
View Full Code Here

TOP

Related Classes of com.scooterframework.orm.activerecord.TableGateway

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.