ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Paul Barry <paul.ba...@nyu.edu>
Subject Re: null BLOB and byte array
Date Mon, 23 May 2005 15:08:26 GMT
If I change these methods in 
com.ibatis.sqlmap.engine.type.BlobTypeHandlerCallback, it works fine:

   public Object getResult(ResultGetter getter)
       throws SQLException {
     Blob blob = getter.getBlob();
     if(blob != null) {
         int size = (int) blob.length();
         return blob.getBytes(1, size);    	
     } else {
     	return null;
     }

   }

   public void setParameter(ParameterSetter setter, Object parameter)
       throws SQLException {
	if(parameter != null) {
	    byte[] bytes = (byte[]) parameter;
	    setter.setBytes(bytes);
	}
   }

Nathan Maves wrote:
> Paul,
> 
> btye[] are objects so having them be null is just fine.
> 
> byte[] test = null;
> 
> I am not sure if there is a test case written for this yet.
> 
> I will look into it.
> 
> Nathan
> On May 23, 2005, at 8:35 AM, Paul Barry wrote:
> 
>> I have a BLOB column in my database that can be null.  I want to  map 
>> it to a byte[], but when I do, I get a NullPointerException.   Anyway 
>> have a good way of dealing with this?
>>
> 

Mime
View raw message