Java tutorial
/* * SurveyPanel * Copyright (C) 2009 Serge Tan Panza * All rights reserved. * License: GNU/GPL License v3 , see LICENSE.txt * SurveyPanel is free software. This version may have been modified pursuant * to the GNU General Public License, and as distributed it includes or * is derivative of works licensed under the GNU General Public License or * other free or open source software licenses. * See COPYRIGHT.txt for copyright notices and details. * */ package com.surveypanel.dao; import java.sql.ResultSet; import java.sql.SQLException; import org.springframework.jdbc.core.RowMapper; import com.surveypanel.form.FormDTO; /** * @author stanpanza * */ public class FormRowHandler implements RowMapper { public Object mapRow(ResultSet rs, int rowNum) throws SQLException { FormDTO formDTO = new FormDTO(); formDTO.setId(rs.getString("id")); formDTO.setSurveyId(rs.getLong("surveyId")); formDTO.setQualified(rs.getBoolean("qualified")); formDTO.setFinish(rs.getBoolean("finish")); formDTO.setUpdated(rs.getDate("updated")); formDTO.setCreated(rs.getDate("created")); formDTO.setVariables(StateRowMapper.getMap(rs.getBlob("js_data"))); formDTO.setXmlContent(rs.getString("xml_data")); return formDTO; } }