Example usage for org.apache.ibatis.session RowBounds RowBounds

List of usage examples for org.apache.ibatis.session RowBounds RowBounds

Introduction

In this page you can find the example usage for org.apache.ibatis.session RowBounds RowBounds.

Prototype

public RowBounds(int offset, int limit) 

Source Link

Usage

From source file:com.glaf.wechat.service.impl.WxModuleServiceImpl.java

License:Apache License

public List<WxModule> getWxModulesByQueryCriteria(int start, int pageSize, WxModuleQuery query) {
    RowBounds rowBounds = new RowBounds(start, pageSize);
    List<WxModule> rows = sqlSessionTemplate.selectList("getWxModules", query, rowBounds);
    return rows;/* w ww .ja va2s .  c o m*/
}

From source file:com.glaf.wechat.service.impl.WxProductServiceImpl.java

License:Apache License

public List<WxProduct> getWxProductsByQueryCriteria(int start, int pageSize, WxProductQuery query) {
    RowBounds rowBounds = new RowBounds(start, pageSize);
    List<WxProduct> rows = sqlSessionTemplate.selectList("getWxProducts", query, rowBounds);
    return rows;/*w w  w .ja va 2s  .co  m*/
}

From source file:com.glaf.wechat.service.impl.WxSiteInfoServiceImpl.java

License:Apache License

public List<WxSiteInfo> getWxSiteInfosByQueryCriteria(int start, int pageSize, WxSiteInfoQuery query) {
    RowBounds rowBounds = new RowBounds(start, pageSize);
    List<WxSiteInfo> rows = sqlSessionTemplate.selectList("getWxSiteInfos", query, rowBounds);
    return rows;//from   w  w w  . j a va2 s  .  c  om
}

From source file:com.glaf.wechat.service.impl.WxTemplateServiceImpl.java

License:Apache License

public List<WxTemplate> getWxTemplatesByQueryCriteria(int start, int pageSize, WxTemplateQuery query) {
    RowBounds rowBounds = new RowBounds(start, pageSize);
    List<WxTemplate> rows = sqlSessionTemplate.selectList("getWxTemplates", query, rowBounds);
    return rows;/*from w w  w .  j a  va  2 s.  co m*/
}

From source file:com.glaf.wechat.service.impl.WxUserServiceImpl.java

License:Apache License

public List<WxUser> getWxUsersByQueryCriteria(int start, int pageSize, WxUserQuery query) {
    RowBounds rowBounds = new RowBounds(start, pageSize);
    List<WxUser> rows = sqlSessionTemplate.selectList("getWxUsers", query, rowBounds);
    return rows;/*ww w . jav  a  2  s.  com*/
}

From source file:com.google.enterprise.connector.db.DBClient.java

License:Apache License

/**
 * @param skipRows number of rows to skip in the database.
 * @param maxRows max number of rows to return.
 * @return rows - subset of the result of executing the SQL query. E.g.,
 *         result table with columns id and lastName and two rows will be
 *         returned as/*from  w  w  w .  j  a v  a  2s  .c  om*/
 *
 *         <pre>
 *         [{id=1, lastName=last_01}, {id=2, lastName=last_02}]
 * </pre>
 * @throws DBException
 */
public List<Map<String, Object>> executePartialQuery(int skipRows, int maxRows)
        throws SnapshotRepositoryRuntimeException {
    // TODO(meghna): Think about a better way to scroll through the result set.
    List<Map<String, Object>> rows;
    LOG.info("Executing partial query with skipRows = " + skipRows + " and " + "maxRows = " + maxRows);
    SqlSession session = getSqlSession();
    try {
        rows = session.selectList("IbatisDBClient.getAll", null, new RowBounds(skipRows, maxRows));
        LOG.info(
                "Sucessfully executed partial query with skipRows = " + skipRows + " and maxRows = " + maxRows);
    } catch (RuntimeException e) {
        checkDBConnection(session, e);
        rows = new ArrayList<Map<String, Object>>();
    } finally {
        session.close();
    }
    LOG.info("Number of rows returned " + rows.size());
    return rows;
}

From source file:com.google.enterprise.connector.db.DBClient.java

License:Apache License

/**
 * Executes the partial parameterized query for given keyValue and
 * returns the list of records having their key value greater than keyValue
 * parameter.//w w  w.java 2 s .c  o m
 *
 * @param keyValue
 * @return list of documents
 */
public List<Map<String, Object>> executeParameterizePartialQuery(Integer keyValue)
        throws SnapshotRepositoryRuntimeException {
    List<Map<String, Object>> rows;
    int skipRows = 0;
    int maxRows = dbContext.getNumberOfRows();
    // Create a hashmap as to provide input parameters minvalue and maxvalue to
    // the query.
    Map<String, Object> paramMap = new HashMap<String, Object>();
    paramMap.put("value", keyValue);
    LOG.info("Executing partial parametrized query with keyValue = " + keyValue);
    SqlSession session = getSqlSession();
    try {
        rows = session.selectList("IbatisDBClient.getAll", paramMap, new RowBounds(skipRows, maxRows));
        LOG.info("Sucessfully executed partial parametrized query with keyValue = " + keyValue);
    } catch (RuntimeException e) {
        checkDBConnection(session, e);
        rows = new ArrayList<Map<String, Object>>();
    } finally {
        session.close();
    }
    LOG.info("Number of rows returned " + rows.size());
    return rows;
}

From source file:com.handu.open.dubbo.monitor.dao.base.DubboInvokeBaseDAO.java

License:Apache License

/**
 * /*ww  w . j  a v a2s. c  o  m*/
 *
 * @param prefix ?
 * @param pageKey 
 * @param countKey ?
 * @param params ?
 * @param offset ???
 * @param limit ??
 * @return Object[]
 */
public Object[] page(String prefix, String pageKey, String countKey, Object params, int offset, int limit) {
    return new Object[] { getSqlSession().selectList(prefix + pageKey, params, new RowBounds(offset, limit)),
            getSqlSession().selectOne(prefix + countKey, params) };
}

From source file:com.holacampus.api.utils.Utils.java

License:Open Source License

/**
 * Crea un objeto {@link RowBounds} para utilizar con la API de MyBatis a partir
 * de la pgina y el tamao/*from   w w w . j  a va  2 s.  c  o m*/
 * @param page pagina
 * @param size tamao
 * @return objeto configurado con los parametros establecidos
 */
public static RowBounds createRowBounds(int page, int size) {
    RowBounds rb = new RowBounds(page * size, size);

    return rb;
}

From source file:com.ibatis.sqlmap.engine.impl.SqlMapSessionImpl.java

License:Apache License

public List queryForList(final String id, final Object parameterObject, final int skip, final int max)
        throws SQLException {
    return (List) transactionManager.doInTransaction(new TransactionScope() {
        public Object execute(Transaction transaction) throws SQLException {
            Executor executor = transaction.getExecutor();
            MappedStatement ms = configuration.getMappedStatement(id);
            return executor.query(ms, wrapCollection(parameterObject), new RowBounds(skip, max), null);
        }/*from   www.j  av a2 s.  c  o m*/
    });
}