Return-Path: X-Original-To: apmail-commons-user-archive@www.apache.org Delivered-To: apmail-commons-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 53946EDCD for ; Sun, 10 Mar 2013 15:33:16 +0000 (UTC) Received: (qmail 50253 invoked by uid 500); 10 Mar 2013 15:33:15 -0000 Delivered-To: apmail-commons-user-archive@commons.apache.org Received: (qmail 49865 invoked by uid 500); 10 Mar 2013 15:33:09 -0000 Mailing-List: contact user-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "Commons Users List" Delivered-To: mailing list user@commons.apache.org Received: (qmail 49835 invoked by uid 99); 10 Mar 2013 15:33:08 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 10 Mar 2013 15:33:08 +0000 X-ASF-Spam-Status: No, hits=1.5 required=5.0 tests=HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of usrbetty@gmail.com designates 209.85.217.193 as permitted sender) Received: from [209.85.217.193] (HELO mail-lb0-f193.google.com) (209.85.217.193) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 10 Mar 2013 15:33:02 +0000 Received: by mail-lb0-f193.google.com with SMTP id n10so618053lbo.8 for ; Sun, 10 Mar 2013 08:32:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:date:message-id:subject:from:to :content-type; bh=3bvDIOk8/A7r/cWedodxzi3BsAXFc48uvJ0diNSrIlI=; b=b6rhHV2GBh0dCpOIzDZn5rRY7p5t3Qz39m+hzPRO9Az6iC7+dWdQWfYammjaiaOnBk 8hCaaX/va7+nTwoX5bzG35yms6JIm07p4eWuyx4cE/AZR0Zyy1dwJ8F4GUN6bHR26NPx BeHJ+907BiwBkVp4jsIDrqgwUUDWqHViyfUnrPru3mZs3iX/7fcKDZF8eaEtyx2i/xrB cGCgzyQpW7He0Zz31iA5b9Ae8vNKEDIlSvgQFd7dRe0luk1PrQYCI93BwSp2EFuumHLn JCBayFWWdfxloDfq4BsQANAIkgHaa65NTz0Z/6o1sdWmAyUlNvTc1B11bxjx8ZbJZa2H pB9g== MIME-Version: 1.0 X-Received: by 10.112.40.167 with SMTP id y7mr3513662lbk.12.1362929561477; Sun, 10 Mar 2013 08:32:41 -0700 (PDT) Received: by 10.112.19.69 with HTTP; Sun, 10 Mar 2013 08:32:41 -0700 (PDT) Date: Sun, 10 Mar 2013 16:32:41 +0100 Message-ID: Subject: [dbutils] From: Betty User To: user@commons.apache.org Content-Type: multipart/alternative; boundary=e0cb4efe31fc5db0b704d793c442 X-Virus-Checked: Checked by ClamAV on apache.org --e0cb4efe31fc5db0b704d793c442 Content-Type: text/plain; charset=ISO-8859-1 Hello, I am creating MVC web application in Spring. With this Java code I'm trying to convert resultset int JavaBeans. List retList = new LinkedList<>(); BasicRowProcessor brp = new BasicRowProcessor(new MonthOrderCountHandler()); BeanListHandler m = new BeanListHandler<>(MonthOrderCount.class, brp); retList.addAll(queryRunner.query(sql, m, Util.utilDateToSqlDate(dateFrom), Util.utilDateToSqlDate(dateTo))); But it doesn't work for me - List is filled with objects (MonthOrderCount), value orderCount is correct but month variable is null. My implementation of MonthOrderCountHandler class: public class MonthOrderCountHandler extends BeanProcessor { @Override public Object toBean(ResultSet rs, Class type) throws SQLException { // Year Year year = new Year(); year.setYearNo(rs.getInt("yearNo")); year.setYear4(rs.getString("year4")); year.setYear2(rs.getString("year2")); // Quarter Quarter quarter = new Quarter(); quarter.setQuarterNo(rs.getInt("quarterNo")); // Month Month m = new Month(); m.setYear(year); m.setQuarter(quarter); m.setMonthAbbreviation(rs.getString("monthAbbreviation")); m.setMonthName(rs.getString("monthName")); m.setMonthNo(rs.getInt("monthNo")); // Final bean MonthOrderCount result = new MonthOrderCount(); result.setMonth(m); result.setOrderCount(rs.getInt("orderCount")); return result; } } Structure of my domain objects is: MonthOrderCount class: public class MonthOrderCount { private Month month; private int orderCount; } Month class: public class Month { private Quarter quarter; private Year year; private int monthNo; private String monthName; private String monthAbbreviation; } Quarter class: public class Quarter { private int quarter; private String abbreviation; } Year class: public class Year { private int yearNo; private String year2; private String year4; } I cannot use standard method: ResultSetHandler> listUrlHandler = new BeanListHandler<>(MonthOrderCount.class); beacuse instances of MonthOrderCount class contains another objects created from values from a row and I need to create them. What am I doing wrong with MonthOrderCountHandler class? Thanks. --e0cb4efe31fc5db0b704d793c442--