ex8_6.txt

来自「j2ee core design patterns」· 文本 代码 · 共 26 行

TXT
26
字号
Example 8.6 	CustomerDAO.java: Cached RowSet Strategy
package com.corej2eepatterns.dao;

// imports

public class CustomerDAO {
	. . .  

	// Create the CachedRowSet using the 
	// ResultSet from query execution    
	public RowSet findCustomersRS(CustomerTO criteria)    
			throws DAOException {

		Connection con = getConnection();
		javax.sql.RowSet rowSet = null;
		String searchSQLString = getSearchSQLString(criteria);
		try {
			con = getConnection();
			java.sql.Statement stmt =
					con.createStatement(. . . );.
			java.sql.ResultSet rs =
					stmt.executeQuery(searchSQLString);
			rowSet = new CachedRowSet();
			rowSet.populate(rs); 
		} catch (SQLException anException) {
			// handle exception

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?