Examples of BeanListHandler


Examples of com.bleujin.framework.db.bean.handlers.BeanListHandler

 
  public void testHandleBean() throws Exception {
    IUserCommand cmd = dc.createUserCommand("select * from copy_tblc") ;
    cmd.setPage(Page.TEN) ;
   
    List<TestBean> beans =  (List<TestBean>)(cmd.execQuery().toHandle(new BeanListHandler(TestBean.class))) ;
    assertEquals(10, beans.size()) ;
  }
View Full Code Here

Examples of com.bleujin.framework.db.bean.handlers.BeanListHandler

 
  public void testHandleBeanProcedure() throws Exception {
    IUserProcedure cmd = dc.createUserProcedure("common@testBy()") ;
    cmd.setPage(Page.TEN) ;
   
    List<TestBean> beans =  (List<TestBean>)(cmd.execQuery().toHandle(new BeanListHandler(TestBean.class))) ;
    assertEquals(10, beans.size()) ;
  }
View Full Code Here

Examples of com.bleujin.framework.db.bean.handlers.BeanListHandler

 
 
  public void testBeanList() throws Exception {
    Rows rows = dc.getRows(query, 10, 1) ;
   
    List<TestBean> results = (List<TestBean>)rows.toHandle(new BeanListHandler(TestBean.class)) ;
    assertEquals(10, results.size()) ;

    TestBean row = results.get(0);
    assertEquals(1, row.getNo1()) ;
    assertEquals("01", row.getNo2()) ;
View Full Code Here

Examples of com.bleujin.framework.db.bean.handlers.BeanListHandler


  public void testClassBean() throws Exception {
    Rows rows = dc.getRows("select * from copy_tblc", 10, 1) ;
   
    List<TestBean> list = (List<TestBean>)rows.toHandle(new BeanListHandler(TestBean.class)) ;
    for(TestBean bean : list){
      Debug.debug(bean) ;
    }
  }
View Full Code Here

Examples of org.apache.commons.dbutils.handlers.BeanListHandler

  {
    try
    {
      return (List<T>) _g_runner.query(getConnection(), sql,
          _IsPrimitive(beanClass) ? _g_columnListHandler
              : new BeanListHandler(beanClass), params);
    }
    catch (SQLException e)
    {
      throw new DBException(e);
    }
View Full Code Here

Examples of org.apache.commons.dbutils.handlers.BeanListHandler

    *           Class to bind object to.
    * @return List
    */
   public List getList(final String sql, final Class clazz) {
      try{
         final ResultSetHandler bean = new BeanListHandler(clazz);
         return (List) runner.query(conn, sql, null, bean);
      }catch (final SQLException e){
         if(GlobalSettings.logActive)
            new LogEngine().logMessage(e.getStackTrace().toString(), GlobalSettings.logPath, "ERROR");
         throw new RuntimeException(e);
View Full Code Here

Examples of org.apache.commons.dbutils.handlers.BeanListHandler

  @SuppressWarnings("rawtypes")
  public static <T> List<T> query(Class<T> beanClass, String sql,
      Object... params) throws SQLException {
      return (List<T>) _runner.query(getConnection(), sql,
                _IsPrimitive(beanClass) ? _columnListHandler
                        : new BeanListHandler(beanClass), params);
  }
View Full Code Here

Examples of org.apache.commons.dbutils.handlers.BeanListHandler

  @SuppressWarnings({ "unchecked", "rawtypes" })
  public  <T> List<T> queryForList(Class<T> entityClass, String sql, Object[] params) {
    List<T> list = new ArrayList<T>();
    try {
      if (params == null) {
        list = (List<T>) qr.query(sql, new BeanListHandler(
            entityClass));
      } else {
        list = (List<T>) qr.query(sql, new BeanListHandler(
            entityClass), params);
      }
    } catch (Exception e) {
      System.err.println("��ѯ�����쳣!ԭ��:" + e);
    }
View Full Code Here

Examples of org.apache.commons.dbutils.handlers.BeanListHandler

        + id;
    QueryRunner qr = DbHelper.getQueryRunner();
    List list = null;
    Comment comment = null;
    try {
      list = (List) qr.query(sql, new BeanListHandler(Comment.class));
      comment = (Comment) list.get(0);
    } catch (SQLException e) {
      e.printStackTrace();
    }
    request.setAttribute("comment", comment);
View Full Code Here

Examples of org.apache.commons.dbutils.handlers.BeanListHandler

    String sql = "select comment_id as id,comment_username as username,comment_content as content ,comment_created_time as createdTime from comment order by comment_id desc";
    QueryRunner qr = DbHelper.getQueryRunner();
    List list = null;
    try {
      list = (List) qr.query(sql, new BeanListHandler(Comment.class));
    } catch (SQLException e) {
      e.printStackTrace();
    }
    request.setAttribute("list", list);
    request.getRequestDispatcher("/admin/adminCommentList.jsp").forward(
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.