View Javadoc
1 /*** $Id: ResultSetRowMapper.java,v 1.1.1.1 2004/05/18 10:50:18 mochoa Exp $ */ 2 package org.j2ee.dao.util; 3 4 import java.sql.ResultSet; 5 import java.sql.SQLException; 6 7 /*** 8 * ResultSetRowMapper interface maps columns of a row of data to instance 9 * variables of an Object that represents an item in a search result set. 10 * This interface is used to hide specific knowledge of the structure of the 11 * rows returned by the underlying JDBC result set. This is usefull in 12 * ResultSets iterators (like ResultSetDataList, see DataListHandler), which 13 * is a generic interface with no specific knowledge of the structure of the 14 * rows returned by the underlying JDBC result set. Thus, it needs some way to 15 * map the columns of a row of data to the instance variables of an Object 16 * passed in as an argument to the get method. 17 * 18 * Last modified $Date: 2004/05/18 10:50:18 $ 19 * @version $Revision: 1.1.1.1 $ 20 * @author jvlio (jvlio@users.sourceforge.net)*/ 21 public interface ResultSetRowMapper { 22 23 /*** 24 * Retrieves the columns of a row of data using ResultSet.getter methods 25 * and stores them in instance variables of item. It returns the populated 26 * item object. 27 * Example:<br> 28 * <code> 29 * EmployeeTO to = (EmployeeTO)item; 30 * //populate 31 * to.setJob(rs.getString(EmployeeTypes.FIELD_JOB)); 32 * to.setDepNo(rs.getInt(EmployeeTypes.FIELD_DEPNO)); 33 * to.setManager(rs.getInt(EmployeeTypes.FIELD_MANAGER)); 34 * to.setName(rs.getString(EmployeeTypes.FIELD_NAME)); 35 * to.setHireDate(rs.getTimestamp(EmployeeTypes.FIELD_HIREDATE)); 36 * to.setComm(rs.getDouble(EmployeeTypes.FIELD_COMM)); 37 * to.setSalary(rs.getDouble(EmployeeTypes.FIELD_SALARY)); 38 * to.setNo(rs.getInt(EmployeeTypes.FIELD_NO)); 39 * //end populate 40 * return to; 41 * </code> 42 */ 43 Object mapRow(ResultSet rs, Object item) throws SQLException; 44 }

This page was automatically generated by Maven