io.github.vteial.maxmoney.jdbc.CustomerRowMapper.java Source code

Java tutorial

Introduction

Here is the source code for io.github.vteial.maxmoney.jdbc.CustomerRowMapper.java

Source

package io.github.vteial.maxmoney.jdbc;

import io.github.vteial.maxmoney.model.Customer;

import java.sql.ResultSet;
import java.sql.SQLException;

import org.springframework.jdbc.core.RowMapper;

public class CustomerRowMapper implements RowMapper<Customer> {

    @Override
    public Customer mapRow(ResultSet resultSet, int intRow) throws SQLException {
        Customer model = new Customer();

        model.setCustomerCode(resultSet.getString("customer_code"));
        model.setCustomerName(resultSet.getString("customer_name"));
        model.setAddress(resultSet.getString("address"));
        model.setTown(resultSet.getString("town"));
        model.setCountry(resultSet.getString("country"));
        model.setPostalCode(resultSet.getString("postal_code"));
        model.setPhone1(resultSet.getString("phone1"));
        model.setPhone2(resultSet.getString("phone2"));
        model.setFax(resultSet.getString("fax"));
        model.setHandPhone(resultSet.getString("hand_phone"));
        model.setEmail(resultSet.getString("email"));
        model.setCustomerType(resultSet.getString("customer_type"));
        model.setAccountNo(resultSet.getString("account_no"));
        model.setBnLicenseNo(resultSet.getString("bn_license_no"));
        model.setLicenseExpiryDate(resultSet.getDate("license_expiry_date"));
        model.setBranchType(resultSet.getString("branch_type"));
        model.setStatus(resultSet.getString("status"));
        model.setPriority(resultSet.getInt("priority"));
        model.setCustomerLocation(resultSet.getString("customer_location"));
        model.setBaseCurrency(resultSet.getString("base_currency"));
        model.setLastBalance(resultSet.getFloat("last_balance"));
        model.setCreateUser(resultSet.getString("create_user"));
        model.setCreateDate(resultSet.getDate("create_date"));
        model.setCreateTime(resultSet.getDate("create_time"));
        model.setUpdateUser(resultSet.getString("update_user"));
        model.setUpdateDate(resultSet.getDate("update_date"));
        model.setUpdateTime(resultSet.getDate("update_time"));

        return model;
    }

}