Code example for ResultSet

Methods: getBoolean, getDate, getInt, getString

0
public class BookCopyRowMapper implements RowMapper<BookCopy>{ 
 
	@Override 
	public BookCopy mapRow(ResultSet resultSet, int i) throws SQLException {
		BookCopy bookCopy = new BookCopy();
		bookCopy.setId(resultSet.getInt("id"));
		bookCopy.setAuthor(resultSet.getString("author"));
		bookCopy.makeAvailable();
		bookCopy.setIsbn(resultSet.getString("isbn"));
		bookCopy.setPublication_Date(resultSet.getDate("publication_date"));
		bookCopy.setLoandate(null);
//		bookCopy.setLoandate(resultSet.getDate("loan_date")); 
		bookCopy.setPublisher(resultSet.getString("publisher"));
		bookCopy.setReturnDate(null);
//		bookCopy.setReturnDate(resultSet.getDate("return_date")); 
		bookCopy.setTitle(resultSet.getString("title"));
		bookCopy.setAvailable(resultSet.getBoolean("available"));
		 
		return bookCopy;
	} 
}