?? gettraderecord.java
字號:
/*
* Created on 2005-7-26
*
*/
package banksystem.business;
/**
* @author 曲本盛
*
* TODO Struts 項目實踐
*/
import java.util.*;
import java.sql.*;
import javax.sql.*;
import banksystem.Constants;
import org.apache.commons.beanutils.RowSetDynaClass;
public class GetTradeRecord {
/**
* @param dataSource 數(shù)據(jù)源.
* @param gene 查詢語句生成器.
* @return List 返回查詢結果List。
*/
public List getTrades(DataSource dataSource,SearchGene gene) throws SQLException{
Connection con = null;
PreparedStatement stat = null;
try{
con = dataSource.getConnection();
stat = con.prepareStatement(Constants.SQL_TRADE_SELECT+gene.getTradeWhereStr());
ResultSet result = stat.executeQuery();
//用該類封裝ResultSet
RowSetDynaClass warpper = new RowSetDynaClass(result);
//調用getRows方法返回一個List對象
return warpper.getRows();
}
catch(SQLException e){
throw new SQLException(e.getMessage());
}
finally{
try{
if(con!=null){
con.close();
}
if(stat!=null){
stat.close();
}
}
catch(Exception e){
throw new SQLException(e.getMessage());
}
}
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -