Return-Path: Mailing-List: contact ibatis-user-java-help@incubator.apache.org; run by ezmlm Delivered-To: mailing list ibatis-user-java@incubator.apache.org Received: (qmail 45063 invoked by uid 99); 13 Jan 2005 21:53:04 -0000 X-ASF-Spam-Status: No, hits=0.4 required=10.0 tests=DNS_FROM_RFC_ABUSE X-Spam-Check-By: apache.org Received-SPF: pass (hermes.apache.org: local policy) Received: from web53110.mail.yahoo.com (HELO web53110.mail.yahoo.com) (206.190.39.213) by apache.org (qpsmtpd/0.28) with SMTP; Thu, 13 Jan 2005 13:53:03 -0800 Received: (qmail 32304 invoked by uid 60001); 13 Jan 2005 21:53:01 -0000 Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; b=DJNHXsc6wIc4nXg1Ly0rwJrx3gR8V9IP0YFX8Fgb2RCHos957m+1gBlR953Y7REY/Xrvt6qQEYyGPL3S54piDmZ1o4Af6SDNSRAfk7oDzPVXL38becpYpf+1ubviMnBYpjNuXpJ428ksQDBPZT/Z8C3J7HWRB5CxD0ysi5dCuU4= ; Message-ID: <20050113215301.32302.qmail@web53110.mail.yahoo.com> Received: from [20.137.2.51] by web53110.mail.yahoo.com via HTTP; Thu, 13 Jan 2005 13:53:00 PST Date: Thu, 13 Jan 2005 13:53:00 -0800 (PST) From: Prashanth Sukumaran Subject: Re: NestedSQLException To: ibatis-user-java@incubator.apache.org In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Virus-Checked: Checked Hi Larry, You are so right. That was a stupid statement from my side. It is safe to have int as Zero in this bean. I will modify the to have zero for int type data. Thanks a lot for you time Prashanth. --- Larry Meadors wrote: > Oops, sorry - I replied just to Prashanth, not the list... > === > If you want null values, the properties *must* be Integer, not int. > You cannot represent a null value in an int. > > In addition, when you create a new Shop instance, all properties of > type int are initialized to 0 (because they cannot be null), so right > away, your bean will be messed up. > === > > On Thu, 13 Jan 2005 09:53:05 -0800 (PST), Prashanth Sukumaran > wrote: > > Hi Larry, > > > > The problem is that i want to leave the value as 'NULL' coz., zero means some value. > > Is there something i can do to fix this issue by leaving int as 'NULL' and still not have this > > error. > > > > What i am not understanding is, if you are taking the 'value' of the field from the resultset > and > > then assigning to the int variable in the bean, Why is there a NullPointer Exception? From the > > metadata description you know that the field is of type number or interger etc. Now i would > > ofcourse use resultset.getInt("columnname"). Assume that i am making a pure jdbc call > directly > > and executing the query and assigning the values to the bean. I will not get this error. > > > > What makes it so different here? > > > > Thanks > > Prashanth. > > > > > > --- Larry Meadors wrote: > > > > > I'd bet money that the int properties are causing that - if you are > > > making int vars null, you MUST specify what the "null" column value > > > should be treated as, because Java cannot do that. > > > > > > My guess is that it is getting a null Integer from the database, and > > > calling intValue() on that null, and...KABOOM! > > > > > > Larry > > > > > > On Thu, 13 Jan 2005 09:36:16 -0800 (PST), wrote: > > > > It is just a simple POJO. I created it using eclipse "Generate getters and setters". > > > > I am pasting the bean here. I have p6spy enabled, I see that the SQL Query is returning > > > exactly > > > > one row. The is a one to one mapping of the column name to the bean fields. > > > > > > > > I am not defining what the "null" column value should be treated as. But that is not > required > > > > right. Also i feel the problem is with the "int" being mapped to "NULL". > > > > > > > > Hasn't anybody had this error????? :-( > > > > > > > > > > > __________________________________ > > Do you Yahoo!? > > Read only the mail you want - Yahoo! Mail SpamGuard. > > http://promotions.yahoo.com/new_mail > > > __________________________________ Do you Yahoo!? Read only the mail you want - Yahoo! Mail SpamGuard. http://promotions.yahoo.com/new_mail