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 <resultmap> to have zero for int type data.

Thanks a lot for you time
Prashanth.

--- Larry Meadors <[EMAIL PROTECTED]> 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
> <[EMAIL PROTECTED]> 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 <[EMAIL PROTECTED]> 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), <[EMAIL PROTECTED]> 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
> >
> 



                
__________________________________ 
Do you Yahoo!? 
Read only the mail you want - Yahoo! Mail SpamGuard. 
http://promotions.yahoo.com/new_mail 

Reply via email to