ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Prashanth Sukumaran <prashanthsukuma...@yahoo.com>
Subject Re: NestedSQLException
Date Thu, 13 Jan 2005 17:53:05 GMT
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 <larry.meadors@gmail.com> 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), <prashanthsukumaran@yahoo.com> 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 <result-map> 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 

Mime
View raw message