@@ -295,10 +295,12 @@ private static void setValue(PreparedStatement ps, int paramIndex, int sqlType,
295295 else if (inValue instanceof SqlValue ) {
296296 ((SqlValue ) inValue ).setValue (ps , paramIndex );
297297 }
298- else if (sqlType == Types .VARCHAR || sqlType == Types .NVARCHAR ||
299- sqlType == Types .LONGVARCHAR || sqlType == Types .LONGNVARCHAR ) {
298+ else if (sqlType == Types .VARCHAR || sqlType == Types .LONGVARCHAR ) {
300299 ps .setString (paramIndex , inValue .toString ());
301300 }
301+ else if (sqlType == Types .NVARCHAR || sqlType == Types .LONGNVARCHAR ) {
302+ ps .setNString (paramIndex , inValue .toString ());
303+ }
302304 else if ((sqlType == Types .CLOB || sqlType == Types .NCLOB ) && isStringValue (inValue .getClass ())) {
303305 String strVal = inValue .toString ();
304306 if (strVal .length () > 4000 ) {
@@ -312,8 +314,15 @@ else if ((sqlType == Types.CLOB || sqlType == Types.NCLOB) && isStringValue(inVa
312314 }
313315 return ;
314316 }
315- // Fallback: regular setString binding
316- ps .setString (paramIndex , strVal );
317+ else {
318+ // Fallback: setString or setNString binding
319+ if (sqlType == Types .NCLOB ) {
320+ ps .setNString (paramIndex , strVal );
321+ }
322+ else {
323+ ps .setString (paramIndex , strVal );
324+ }
325+ }
317326 }
318327 else if (sqlType == Types .DECIMAL || sqlType == Types .NUMERIC ) {
319328 if (inValue instanceof BigDecimal ) {
0 commit comments