ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stan Ou <jou...@yahoo.com>
Subject null value from db query caused ibatis setProperty error
Date Tue, 12 Jul 2005 15:24:26 GMT
Hi all,

I have a simple query and its result is mapped to a
Java value object (vo), pretty straight forward stuff.
 My problem is that one of my properties in my vo is a
float type (or any primitive numeric type for that
and the corresponding db column returns null from the

This acutally caused ibatis to throw an error in
com.ibatis.common.beans.ComplexBeanProbe.java on
  method.invoke(object, params);

Here it's trying call method setBlaBlah(float f) via
reflection and passing params (params is null, in this
case.)  Since setBlaBlah() takes in a primitive float
type, passing a null causes it to throw an error.  My
is has anyone run into this problem and how did you
fix it?  

My temp work around is to modify that class by first
checking if params is null.  If it's null, don't set
the property.  But this created another undesired
side-effect.  when my vo is instantiated, the float
property is initialized to 0.0, which is how Java does
things, since setBlaBlah(float f) never got called ,
now that property shows up as 0.0 instead of nothing.

Any comments/suggestions are greatly appreciatged.


Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 

View raw message