org.j2ee.dao.util
Interface ResultSetRowMapper


public interface ResultSetRowMapper

ResultSetRowMapper interface maps columns of a row of data to instance variables of an Object that represents an item in a search result set. This interface is used to hide specific knowledge of the structure of the rows returned by the underlying JDBC result set. This is usefull in ResultSets iterators (like ResultSetDataList, see DataListHandler), which is a generic interface with no specific knowledge of the structure of the rows returned by the underlying JDBC result set. Thus, it needs some way to map the columns of a row of data to the instance variables of an Object passed in as an argument to the get method. Last modified $Date: 2004/05/18 10:50:18 $

Version:
$Revision: 1.1.1.1 $
Author:
jvlio (jvlio@users.sourceforge.net)

Method Summary
 java.lang.Object mapRow(java.sql.ResultSet rs, java.lang.Object item)
          Retrieves the columns of a row of data using ResultSet.getter methods and stores them in instance variables of item.
 

Method Detail

mapRow

public java.lang.Object mapRow(java.sql.ResultSet rs,
                               java.lang.Object item)
                        throws java.sql.SQLException
Retrieves the columns of a row of data using ResultSet.getter methods and stores them in instance variables of item. It returns the populated item object. Example:
EmployeeTO to = (EmployeeTO)item; //populate to.setJob(rs.getString(EmployeeTypes.FIELD_JOB)); to.setDepNo(rs.getInt(EmployeeTypes.FIELD_DEPNO)); to.setManager(rs.getInt(EmployeeTypes.FIELD_MANAGER)); to.setName(rs.getString(EmployeeTypes.FIELD_NAME)); to.setHireDate(rs.getTimestamp(EmployeeTypes.FIELD_HIREDATE)); to.setComm(rs.getDouble(EmployeeTypes.FIELD_COMM)); to.setSalary(rs.getDouble(EmployeeTypes.FIELD_SALARY)); to.setNo(rs.getInt(EmployeeTypes.FIELD_NO)); //end populate return to;

java.sql.SQLException


Copyright © 2004 DAO Action Patterm. All Rights Reserved.