ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Poitras Christian" <Christian.Poit...@ircm.qc.ca>
Subject RE: reading nullable columns via iBATIS SqlMap
Date Wed, 17 May 2006 21:45:50 GMT
Are you trying to put a null into a non-nullable type like int or
double? 

If this is the case, you must use the object equivalent: Integer,
Double, etc...

-----Original Message-----
From: Vadim Grinshpun [mailto:vadim@ll.mit.edu] 
Sent: Wednesday, 17 May 2006 17:31
To: user-java@ibatis.apache.org
Subject: reading nullable columns via iBATIS SqlMap

Hi all,

I'm attempting to read in data from a small table with some nullable
columns  into a bean that contains corresponding properties.
Everything works fine if no nulls are present in the table. The only way
I could get it to work with nulls was to write a result map with
"nullValue" attributes specified for all nullable columns. If I omit the
nullValue attribute, or if I use inline parameters instead of a result
map, a NullPointerException is thrown by iBATIS code. Is this the
expected behavior?
I was hoping that a column with a null value would be translated into a
Java null and would simply leave the bean's property set to null. 
Specifying nullValue means that the property always gets set to some
non-null value, which is not exactly what I want.

Any help would be greatly appreciated!

FYI: I am using the latest iBATIS release (2.1.7). I have no easy way of
getting the exception stack trace to the machine I'm emailing from, but
if it is needed, let me know, I can try to outline the trace a bit.

Again, thanks.

-Vadim Grinshpun


Mime
View raw message