Re: [jrf-user] Nullable Blobs
Brought to you by:
joncrlsn
|
From: Thom C. <TCa...@ps...> - 2002-11-20 21:15:33
|
We had a similar problem on Oracle. A solution that worked for us was to set the default value for the blob field to be "empty_blob()", which is distinctly different from <null>, and everything was happy. I do not know if this is a common function available in other databases, so yours would definitely be a more universal approach. Thom >>> "Cinq - Glaucio Polzin de Oliveira" <g.p...@ci...> 11/19/2002 9:29:12 PM >>> Hi, I was using Blobs with JRF and MySql. I had problems when my blob column was nullable (new NullableColumnOption() in my setup method). When it is null and I tried to save it, I got a NullPointerException. It happened because the method getColumnValueFrom in the net.sf.jrf.column.columnspecs.BlobColumnSpec class was not testing if the BlobWrapper is null or not: BlobWrapper b = (BlobWrapper) value; b.storeData(stmt, position, super.i_sqlType); when b is null, I get a NullPointerException. I've found a very simple solution: verify if b is not null: BlobWrapper b = (BlobWrapper) value; if (b != null) b.storeData(stmt, position, super.i_sqlType); else stmt.setNull(position, null, super.i_sqlType); I did the same thing when this is selected from the database in the getColumnValueFrom from the same class: Blob value = jrfResultSet.getBlob(this.getColumnIdx()); return (value == null ? null : new BlobWrapper(value)); Am I wrong? Did someone have this problem? I am using the 'IBM Websphere Studio Application Developer' to program. Thanks Glaucio __________________________________ Cinq Technologies - http://www.cinq.com.br ------------------------------------------------------- This sf.net email is sponsored by: To learn the basics of securing your web site with SSL, click here to get a FREE TRIAL of a Thawte Server Certificate: http://www.gothawte.com/rd524.html _______________________________________________ jrf-user mailing list jrf...@li... https://lists.sourceforge.net/lists/listinfo/jrf-user |