コード例 #1
0
ファイル: ItemDAOImpl.java プロジェクト: asiam9/commerce4j
    /* (non-Javadoc)
     * @see org.springframework.jdbc.core.RowMapper#mapRow(java.sql.ResultSet, int)
     */
    public Object mapRow(ResultSet rs, int rowNum) throws SQLException {

      StoreDTO store = new StoreDTO();
      store.setStoreId(rs.getInt("store_id"));
      store.setStoreName(rs.getString("store_name"));

      UserDTO user = new UserDTO();
      user.setUserId(rs.getLong("user_id"));
      user.setUserName(rs.getString("user_name"));
      user.setEmailAddress(rs.getString("email_address"));
      user.setLastName(rs.getString("lastname"));
      user.setFirstName(rs.getString("firstname"));

      TypeDTO type = new TypeDTO();
      type.setTypeId(rs.getInt("type_id"));
      type.setTypeName(rs.getString("type_name"));
      type.setTypeDesc(rs.getString("type_desc"));

      CurrencyDTO currency = new CurrencyDTO();
      currency.setCurrencySymbol(rs.getString("currency_symbol"));
      currency.setCurrencyAbrev(rs.getString("currency_abrev"));

      StatusDTO status = new StatusDTO();
      status.setStatusName(rs.getString("status_name"));

      BrandDTO brand = new BrandDTO();
      brand.setBrandId(rs.getInt("brand_id"));
      brand.setBrandName(rs.getString("brand_name"));
      brand.setFeatured(rs.getInt("featured"));

      ItemDTO item = new ItemDTO();
      item.setItemId(rs.getLong("item_id"));
      item.setItemTitle(rs.getString("item_title"));
      item.setItemDesc(rs.getString("item_desc"));
      item.setItemPrice(rs.getDouble("item_price"));
      item.setCreated(rs.getDate("created"));
      item.setItemStatus(rs.getInt("item_status"));
      item.setItemSku(rs.getString("item_sku"));

      item.setBrand(brand);
      item.setStore(store);
      item.setUser(user);
      item.setType(type);
      item.setCurrency(currency);
      item.setStatus(status);

      return item;
    }