Hi all, I'm developing a j2ee web application using ibatis to interact with a ms sql server 2000. I've to perform this operation: <insert id="insertAnnuncioFileMD" parameterClass="tsf.sara.sqlmap.AnnuncioFileMD"> begin transaction declare @id_audio varchar(20)
set @id_audio = cast(IDENT_CURRENT('filemd') + ident_incr('filemd') as varchar) INSERT INTO filemd(fname, fsize, furl, fcdate, station_id, status, diagMask, md5sig, msgId, idaudio) SELECT #fname#, #fsize#, #furl#, #fcdate#, id,#status#, #diagMask#, #md5sig#, #msgId#, #idaudio# FROM station WHERE name = #stationName# INSERT INTO annunci(idannuncio, codloc, dataorainizioann, dataorafineann, dataorainiziorec, idaudio, msgannuncio, codmas, stannuncio, lingua) VALUES (#idannuncio#, #codloc#, #dataorainizioann#, #dataorafineann#, #dataorainiziorec#, @id_audio, #msgannuncio#, #codmas#, #stannuncio#, #lingua#) commit transaction GO </insert> where stannuncio is a char type (CHAR for db and char for java) I've tried to configure a handler in this way: public class CharTypeHandlerCallback implements TypeHandlerCallback { public Object getResult(ResultGetter getter) throws SQLException { System.out.println("Inside getResult"); if(getter.wasNull()) return null; return getter.getString(); } public void setParameter(ParameterSetter setter, Object parameter) throws SQLException { System.out.println("Inside setParameter"); if (parameter == null) { setter.setNull(Types.CHAR); } else { setter.setString((String)parameter.toString()); } } public Object valueOf(String s) { System.out.println("Inside valueOf"); return s; } } and added it in SqlMApCOnfig as <typeHandler javaType="java.lang.String" jdbcType="CHAR" callback="tsf.sara.sqlmap.CharTypeHandlerCallback"/> When I call the insert sqlMap.insert("insertAnnuncioFileMD", annuncioFileMD) I get --- The error occurred in SARA-SqlMap.xml. --- The error occurred while applying a parameter map. --- Check the insertAnnuncioFileMD-InlineParameterMap. --- Check the parameter mapping for the 'stannuncio' property. --- Cause: java.lang.NullPointerException stannuncio is set to a 'A'. I don't see where I'm wrong, have you any suggestion? Thanx, Michela -- View this message in context: http://www.nabble.com/MS-Sql-Server-2000-and-access-to-a-CHAR-column-tp23653653p23653653.html Sent from the iBATIS - User - Java mailing list archive at Nabble.com.