Beispiel #1
0
  /**
   * @param limit limit
   * @param offset offset
   * @param example Example
   * @return Page
   * @see com.tsc9526.monalisa.core.resources.HelpDoc#helpQuery(int,int,Example,String, Object...)
   */
  public Page<T> selectPageByExample(int limit, int offset, Example example) {
    Query w = QEH.getQuery(example);

    Query query = model.dialect().select(model, w.getSql(), w.getParameters());
    query.use(db());

    Page<T> r = (Page<T>) query.getPage(getResultCreator(query), limit, offset);
    return r;
  }
Beispiel #2
0
  /**
   * @param example Example
   * @return the first record
   * @see com.tsc9526.monalisa.core.resources.HelpDoc#helpQuery(int,int,Example,String, Object...)
   */
  public T selectOneByExample(Example example) {
    Query w = QEH.getQuery(example);

    Query query = model.dialect().selectOne(model, w.getSql(), w.getParameters());
    query.use(db());

    T r = (T) query.getResult(getResultCreator(query));
    return r;
  }
Beispiel #3
0
  /**
   * @param example Example
   * @return DataTable
   * @see com.tsc9526.monalisa.core.resources.HelpDoc#helpQuery(int,int,Example,String, Object...)
   */
  public DataTable<T> selectByExample(Example example) {
    Query w = QEH.getQuery(example);

    Query query = model.dialect().select(model, w.getSql(), w.getParameters());
    query.use(db());

    DataTable<T> r = (DataTable<T>) query.getList(getResultCreator(query));
    return r;
  }
Beispiel #4
0
  /**
   * @param example Example
   * @return count of records
   * @see com.tsc9526.monalisa.core.resources.HelpDoc#helpQuery(int,int,Example,String, Object...)
   */
  public long count(Example example) {
    Query w = QEH.getQuery(example);

    return count(w.getSql(), w.getParameters());
  }