浏览 1539 次
精华帖 (0) :: 良好帖 (0) :: 新手帖 (0) :: 隐藏帖 (11)
|
|
---|---|
作者 | 正文 |
发表时间:2011-12-25
最后修改:2011-12-25
{String.class, int.class ,Integer.class, long.class,Long.class, java.sql.Timestamp.class,java.sql.Date.class,java.util.Date.class, boolean.class ,Boolean.class, BigFile.class,//bboss的大文件对象 float.class ,Float.class, short.class ,Short.class, double.class,Double.class, char.class ,Character.class, byte.class ,Byte.class, BigDecimal.class}; 下面就是具体的使用方法,以SQLExecutor组件为例来说明(ConfigSQLExecutor类似,这里不做过多说明): @Test public void dynamicqueryBean() throws SQLException { ListBean bean = new ListBean(); bean.setFieldName("阿斯顿飞"); //<property name="refresh_interval" value="10000"/> List<ListBean> result = SQLExecutor.queryListBean(ListBean.class, "select * from LISTBEAN", bean); System.out.println(result.size()); bean.setFieldName(""); result = (List<ListBean>) SQLExecutor.queryListBean(ListBean.class,"select * from LISTBEAN", bean); System.out.println(result.size()); bean.setFieldName(null); result = (List<ListBean>) SQLExecutor.queryListBean(ListBean.class,"select * from LISTBEAN", bean); System.out.println(result.size()); List<String> result_string = SQLExecutor.queryListBean(String.class,"select * from LISTBEAN", bean); System.out.println(result_string.size()); List<Integer> result_int = SQLExecutor.queryListBean(Integer.class,"select * from LISTBEAN", bean); System.out.println(result_int.size()); } @Test public void dynamicquery() throws SQLException { List<ListBean> result = SQLExecutor.queryList(ListBean.class,"select id from LISTBEAN"); System.out.println(result.size()); List<String> result_string = SQLExecutor.queryList(String.class,"select id from LISTBEAN"); System.out.println(result_string.size()); List<Integer> result_int = SQLExecutor.queryList(Integer.class,"select id from LISTBEAN"); System.out.println(result_int.size()); } @Test public void dynamicqueryObject() throws SQLException { ListBean result = SQLExecutor.queryObject(ListBean.class,"select id from LISTBEAN"); System.out.println(result.getId()); String result_string = SQLExecutor.queryObject(String.class,"select id from LISTBEAN"); System.out.println(result_string); int result_int = SQLExecutor.queryObject(int.class,"select id from LISTBEAN"); System.out.println(result_int); } bboss的开发环境参考文档: 搭建自己的bbossmvc eclipse开发工程,编写第一个实例 声明:ITeye文章版权属于作者,受法律保护。没有作者书面许可不得转载。
推荐链接
|
|
返回顶楼 | |