Java tutorial
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package com.rajaram.bookmark.jdbc; import com.rajaram.bookmark.model.Bookmark; import java.sql.ResultSet; import java.sql.SQLException; import java.util.ArrayList; import java.util.List; import org.springframework.jdbc.core.RowMapper; /** * * @author Rajaram * @since 21-04-2104 * @version 0.1 */ public class BookmarkRowMapper implements RowMapper<Bookmark> { /** * Extract user data from the SQL result set. * * @param resultSet SQL result set * @return List of users. * @throws SQLException */ public List<Bookmark> mapRow(ResultSet resultSet) throws SQLException { BookmarkExtractor bookmarkExtractor = new BookmarkExtractor(); List<Bookmark> bookmarkList = new ArrayList<>(); while (resultSet.next()) { bookmarkList.add(bookmarkExtractor.extractData(resultSet)); } return bookmarkList; } @Override public Bookmark mapRow(ResultSet rs, int i) throws SQLException { throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. } }