Exemple #1
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;
  }
Exemple #2
0
 public long count() {
   Query query = model.dialect().count(model, null);
   query.use(db());
   return query.getResult(Long.class);
 }
Exemple #3
0
 /**
  * @param whereStatement where cause
  * @param args args
  * @return count of records
  * @see com.tsc9526.monalisa.core.resources.HelpDoc#helpQuery(int,int,Example,String, Object...)
  */
 public long count(String whereStatement, Object... args) {
   Query query = model.dialect().count(model, whereStatement, args);
   query.use(db());
   return query.getResult(Long.class);
 }
Exemple #4
0
 /**
  * @param whereStatement where cause
  * @param args args
  * @return the first record
  * @see com.tsc9526.monalisa.core.resources.HelpDoc#helpQuery(int,int,Example,String,Object...)
  */
 public T selectOne(String whereStatement, Object... args) {
   Query query = model.dialect().selectOne(model, whereStatement, args);
   query.use(db());
   T r = (T) query.getResult(getResultCreator(query));
   return r;
 }