Return-Path: Delivered-To: apmail-ibatis-user-java-archive@www.apache.org Received: (qmail 76595 invoked from network); 2 May 2008 03:41:13 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 2 May 2008 03:41:13 -0000 Received: (qmail 82053 invoked by uid 500); 2 May 2008 03:41:08 -0000 Delivered-To: apmail-ibatis-user-java-archive@ibatis.apache.org Received: (qmail 82036 invoked by uid 500); 2 May 2008 03:41:08 -0000 Mailing-List: contact user-java-help@ibatis.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user-java@ibatis.apache.org Delivered-To: mailing list user-java@ibatis.apache.org Received: (qmail 82025 invoked by uid 99); 2 May 2008 03:41:08 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 01 May 2008 20:41:08 -0700 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: local policy) Received: from [63.249.95.37] (HELO mail.cruzio.com) (63.249.95.37) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 02 May 2008 03:40:15 +0000 Received: from [192.168.0.103] (dsl-63-249-97-217.cruzio.com [63.249.97.217]) by mail.cruzio.com with ESMTP id m423eZ7M095291 for ; Thu, 1 May 2008 20:40:35 -0700 (PDT) Message-ID: <481A8DD4.60407@cruzio.com> Date: Thu, 01 May 2008 20:43:16 -0700 From: Richard Yee User-Agent: Thunderbird 1.4 (Windows/20050908) MIME-Version: 1.0 To: user-java@ibatis.apache.org Subject: Re: DAO class not getting values from query References: <004401c8abac$2a040410$13ed51c7@corp.ds.fedex.com> In-Reply-To: <004401c8abac$2a040410$13ed51c7@corp.ds.fedex.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org David, Since you are doing a join on the tables, I suggest either using column or columnIndex in your result tags but not both. If you use column, you should change the select to Use of the jdbcType attribute is also not really necessary in this case either. -Richard David Momper wrote: > Hi all, > I have a page that displays a list or airports from a database query. The > page displays the correct database values from some fields, null values from > others. Through debugging, I have figured out that the fields that display > as null are never set to begin with, but as best I can tell, they should be. > > Some of the fields with problems are identical in structure to fields with > no problems. Latitude/longitude, and airport id are all Integers in my java > class, and are NUMBER in Oracle. Lat/lon get proper values, id remains > null. Of the fields I query, only latitude, longitude, and name get > non-null values. I have verified that if I directly perform the query > against the database, all proper values are returned, so the query is not my > problem. I suspect that the problem lies in my resultMap, but I haven't > been able to figure out what is wrong there. > > I use Ibatis and Spring, with an Oracle 10g database. Relevant code is > included below. Any help would be greatly appreciated. > > The SQL map xml file: > > > column="AIRPORT_ID" columnIndex="1"/> > jdbcType="CHAR(3)" column="IATA_CODE" columnIndex="2"/> > jdbcType="CHAR(4)" column="ICAO_CODE" columnIndex="3"/> > jdbcType="NUMBER" column="LATITUDE" columnIndex="4"/> > jdbcType="NUMBER" column="LONGITUDE" columnIndex="5"/> > jdbcType="TIMESTAMP" column="START_DATE" columnIndex="6"/> > jdbcType="TIMESTAMP" column="END_DATE" columnIndex="7"/> > jdbcType="VARCHAR2" column="NAME" columnIndex="8"/> > > > > > AirportSqlMapDao class has: > public List getAirportList() { > return > (List)getSqlMapClientTemplate().queryForList("getAirportList"); > } > > The fields from the Airport class. Getter/setter methods are typical > getter/setters. > private Integer id; > private String name; > private String iataCode; > private String icaoCode; > private Integer latitude; > private Integer longitude; > private String startDate, endDate; > > > My manager class: > public class SimpleAirportManager implements AirportManager { > private AirportDao airportDao; > public List getAirports() { > return airportDao.getAirportList(); > } > public void setAirportDao(AirportDao airportDao) { > this.airportDao = airportDao; > } > } > > My controller has the code: > public ModelAndView handleRequest(HttpServletRequest request, > HttpServletResponse response) throws ServletException, IOException { > Map myModel = new HashMap(); > myModel.put("airports", this.airportManager.getAirports()); > return new ModelAndView("hello", "model", myModel); > } > > This is the code from the display page: > > > > > > > > > > > > > > >
IDNameIATA codeICAO > codeLatitudeLongitudeStart DateEnd > Date
> > >