@@ -365,19 +365,17 @@ private boolean applyPropertyMappings(ResultSetWrapper rsw, ResultMap resultMap,
365
365
|| propertyMapping .getResultSet () != null ) {
366
366
Object value = getPropertyMappingValue (rsw .getResultSet (), metaObject , propertyMapping , lazyLoader , columnPrefix );
367
367
final String property = propertyMapping .getProperty (); // issue #541 make property optional
368
- if (value != NO_VALUE && property != null && (value != null || isCallSettersOnNulls (metaObject .getSetterType (property )))) { // issue #377, call setter on nulls
369
- metaObject .setValue (property , value );
368
+ if (value != NO_VALUE && property != null && (value != null || configuration .isCallSettersOnNulls ())) { // issue #377, call setter on nulls
369
+ if (value != null || !metaObject .getSetterType (property ).isPrimitive ()) {
370
+ metaObject .setValue (property , value );
371
+ }
370
372
foundValues = (value != null ) || foundValues ;
371
373
}
372
374
}
373
375
}
374
376
return foundValues ;
375
377
}
376
378
377
- private boolean isCallSettersOnNulls (Class <?> propertyType ) {
378
- return configuration .isCallSettersOnNulls () && !propertyType .isPrimitive ();
379
- }
380
-
381
379
private Object getPropertyMappingValue (ResultSet rs , MetaObject metaResultObject , ResultMapping propertyMapping , ResultLoaderMap lazyLoader , String columnPrefix )
382
380
throws SQLException {
383
381
if (propertyMapping .getNestedQueryId () != null ) {
@@ -415,9 +413,11 @@ private boolean applyAutomaticMappings(ResultSetWrapper rsw, ResultMap resultMap
415
413
if (typeHandlerRegistry .hasTypeHandler (propertyType )) {
416
414
final TypeHandler <?> typeHandler = rsw .getTypeHandler (propertyType , columnName );
417
415
final Object value = typeHandler .getResult (rsw .getResultSet (), columnName );
418
- if (value != null || isCallSettersOnNulls (propertyType )) { // issue #377, call setter on nulls
419
- metaObject .setValue (property , value );
420
- foundValues = (value != null ) || foundValues ;
416
+ if (value != null || configuration .isCallSettersOnNulls ()) { // issue #377, call setter on nulls
417
+ if (value != null || !propertyType .isPrimitive ()) {
418
+ metaObject .setValue (property , value );
419
+ }
420
+ foundValues = true ;
421
421
}
422
422
}
423
423
}
0 commit comments