@@ -330,7 +330,7 @@ private Object getRowValue(ResultSetWrapper rsw, ResultMap resultMap, CacheKey r
330
330
if (resultObject != null && !typeHandlerRegistry .hasTypeHandler (resultMap .getType ())) {
331
331
final MetaObject metaObject = configuration .newMetaObject (resultObject );
332
332
boolean foundValues = resultMap .getConstructorResultMappings ().size () > 0 ;
333
- if (shouldApplyAutomaticMappings (resultMap , !AutoMappingBehavior .NONE .equals (configuration .getAutoMappingBehavior ()))) {
333
+ if (shouldApplyAutomaticMappings (resultMap , null , !AutoMappingBehavior .NONE .equals (configuration .getAutoMappingBehavior ()))) {
334
334
foundValues = applyAutomaticMappings (rsw , resultMap , metaObject , null ) || foundValues ;
335
335
}
336
336
foundValues = applyPropertyMappings (rsw , resultMap , metaObject , lazyLoader , null ) || foundValues ;
@@ -341,8 +341,9 @@ private Object getRowValue(ResultSetWrapper rsw, ResultMap resultMap, CacheKey r
341
341
return resultObject ;
342
342
}
343
343
344
- private boolean shouldApplyAutomaticMappings (ResultMap resultMap , boolean def ) {
345
- return resultMap .getAutoMapping () != null ? resultMap .getAutoMapping () : def ;
344
+ private boolean shouldApplyAutomaticMappings (ResultMap resultMap , Boolean parentAutoMapping , boolean def ) {
345
+ return resultMap .getAutoMapping () != null ? resultMap .getAutoMapping ()
346
+ : parentAutoMapping != null ? parentAutoMapping : def ;
346
347
}
347
348
348
349
private ResultLoaderMap instantiateResultLoaderMap () {
@@ -725,9 +726,9 @@ private void handleRowValuesForNestedResultMap(ResultSetWrapper rsw, ResultMap r
725
726
nestedResultObjects .clear ();
726
727
storeObject (resultHandler , resultContext , rowValue , parentMapping , rsw .getResultSet ());
727
728
}
728
- rowValue = getRowValue (rsw , discriminatedResultMap , rowKey , rowKey , null , partialObject );
729
+ rowValue = getRowValue (rsw , discriminatedResultMap , rowKey , rowKey , null , partialObject , null );
729
730
} else {
730
- rowValue = getRowValue (rsw , discriminatedResultMap , rowKey , rowKey , null , partialObject );
731
+ rowValue = getRowValue (rsw , discriminatedResultMap , rowKey , rowKey , null , partialObject , null );
731
732
if (partialObject == null ) {
732
733
storeObject (resultHandler , resultContext , rowValue , parentMapping , rsw .getResultSet ());
733
734
}
@@ -742,7 +743,7 @@ private void handleRowValuesForNestedResultMap(ResultSetWrapper rsw, ResultMap r
742
743
// GET VALUE FROM ROW FOR NESTED RESULT MAP
743
744
//
744
745
745
- private Object getRowValue (ResultSetWrapper rsw , ResultMap resultMap , CacheKey combinedKey , CacheKey absoluteKey , String columnPrefix , Object partialObject ) throws SQLException {
746
+ private Object getRowValue (ResultSetWrapper rsw , ResultMap resultMap , CacheKey combinedKey , CacheKey absoluteKey , String columnPrefix , Object partialObject , Boolean parentAutoMapping ) throws SQLException {
746
747
Object resultObject = partialObject ;
747
748
if (resultObject != null ) {
748
749
final MetaObject metaObject = configuration .newMetaObject (resultObject );
@@ -755,7 +756,7 @@ private Object getRowValue(ResultSetWrapper rsw, ResultMap resultMap, CacheKey c
755
756
if (resultObject != null && !typeHandlerRegistry .hasTypeHandler (resultMap .getType ())) {
756
757
final MetaObject metaObject = configuration .newMetaObject (resultObject );
757
758
boolean foundValues = resultMap .getConstructorResultMappings ().size () > 0 ;
758
- if (shouldApplyAutomaticMappings (resultMap , AutoMappingBehavior .FULL .equals (configuration .getAutoMappingBehavior ()))) {
759
+ if (shouldApplyAutomaticMappings (resultMap , parentAutoMapping , AutoMappingBehavior .FULL .equals (configuration .getAutoMappingBehavior ()))) {
759
760
foundValues = applyAutomaticMappings (rsw , resultMap , metaObject , columnPrefix ) || foundValues ;
760
761
}
761
762
foundValues = applyPropertyMappings (rsw , resultMap , metaObject , lazyLoader , columnPrefix ) || foundValues ;
@@ -792,7 +793,7 @@ private boolean applyNestedResultMappings(ResultSetWrapper rsw, ResultMap result
792
793
boolean knownValue = (rowValue != null );
793
794
final Object collectionProperty = instantiateCollectionPropertyIfAppropriate (resultMapping , metaObject );
794
795
if (anyNotNullColumnHasValue (resultMapping , columnPrefix , rsw .getResultSet ())) {
795
- rowValue = getRowValue (rsw , nestedResultMap , combinedKey , rowKey , columnPrefix , rowValue );
796
+ rowValue = getRowValue (rsw , nestedResultMap , combinedKey , rowKey , columnPrefix , rowValue , resultMap . getAutoMapping () );
796
797
if (rowValue != null && !knownValue ) {
797
798
if (collectionProperty != null ) {
798
799
final MetaObject targetMetaObject = configuration .newMetaObject (collectionProperty );
0 commit comments