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 Thu, 18 May 2006 13:56:13 GMT
I think you should send the exception stack trace if possible.

I use many nullable columns without any problems. This could be a
problem with your jdbc driver (or are you using another type of

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

No, the type in question is a String, which is quite nullable--hence my
surprise that this doesn't work as I'd expect.

(I ran into the int vs Integer issue previously, but a search of the
mailing list archive helped solve that :) -Vadim

Christian Poitras wrote:

Are you trying to put a null into a non-nullable type like int or

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

View raw message