日期:2014-05-19 浏览次数:21302 次
    public void biz() {
        List<Object> beans = new ArrayList<Object>();
        // 业务代码
        // ..
        for (int i = 0; i < beans.size(); i++) {
            String Name = getNameById(beans.get(i));
        }
        // ..
    }
    private String getNameById(Object object) {
        Connection conn = null;
        try {
            // ...取连接用连接池
            return null;
        } catch (Exception e) {
            throw new RuntimeException(e);
        } finally {
            if (conn != null) {
                try {
                    conn.close();
                } catch (SQLException e) {
                }
            }
        }
    }