@@ -108,11 +108,13 @@ public class DefaultResultSetHandler implements ResultSetHandler {
108
108
private boolean useConstructorMappings ;
109
109
110
110
private static class PendingRelation {
111
+
111
112
public MetaObject metaObject ;
112
113
public ResultMapping propertyMapping ;
113
114
}
114
115
115
116
private static class UnMappedColumnAutoMapping {
117
+
116
118
private final String column ;
117
119
private final String property ;
118
120
private final TypeHandler <?> typeHandler ;
@@ -1047,42 +1049,35 @@ private void handleRowValuesForNestedResultMap(ResultSetWrapper rsw, ResultMap r
1047
1049
final Object partialObject = nestedResultObjects .get (rowKey );
1048
1050
final boolean foundNewUniqueRow = partialObject == null ;
1049
1051
1050
- // (issue #101) - found a new row, finish off the last creation
1051
- if (foundNewUniqueRow && lastHandledCreation != null ) {
1052
- createAndStorePendingCreation (resultHandler , parentMapping , resultSet , resultContext , lastHandledCreation );
1053
- lastHandledCreation = null ;
1054
- }
1052
+ // issue #577, #542 && #101
1053
+ if (useCollectionConstructorInjection ) {
1054
+ if (foundNewUniqueRow && lastHandledCreation != null ) {
1055
+ createAndStorePendingCreation (resultHandler , parentMapping , resultSet , resultContext , lastHandledCreation );
1056
+ lastHandledCreation = null ;
1057
+ }
1055
1058
1056
- // issue #577 && #542
1057
- if (mappedStatement .isResultOrdered ()) {
1059
+ rowValue = getRowValue (rsw , discriminatedResultMap , rowKey , null , partialObject );
1060
+ if (rowValue instanceof PendingConstructorCreation ) {
1061
+ lastHandledCreation = (PendingConstructorCreation ) rowValue ;
1062
+ }
1063
+ } else if (mappedStatement .isResultOrdered ()) {
1058
1064
if (foundNewUniqueRow && rowValue != null ) {
1059
1065
nestedResultObjects .clear ();
1060
- if (!useCollectionConstructorInjection ) {
1061
- storeObject (resultHandler , resultContext , rowValue , parentMapping , resultSet );
1062
- }
1066
+ storeObject (resultHandler , resultContext , rowValue , parentMapping , resultSet );
1063
1067
}
1064
1068
rowValue = getRowValue (rsw , discriminatedResultMap , rowKey , null , partialObject );
1065
1069
} else {
1066
1070
rowValue = getRowValue (rsw , discriminatedResultMap , rowKey , null , partialObject );
1067
-
1068
1071
if (foundNewUniqueRow ) {
1069
- if (!useCollectionConstructorInjection ) {
1070
- storeObject (resultHandler , resultContext , rowValue , parentMapping , resultSet );
1071
- }
1072
+ storeObject (resultHandler , resultContext , rowValue , parentMapping , resultSet );
1072
1073
}
1073
1074
}
1074
-
1075
- if (useCollectionConstructorInjection && rowValue instanceof PendingConstructorCreation ) {
1076
- lastHandledCreation = (PendingConstructorCreation ) rowValue ;
1077
- }
1078
1075
}
1079
1076
1080
1077
if (useCollectionConstructorInjection && lastHandledCreation != null ) {
1081
1078
createAndStorePendingCreation (resultHandler , parentMapping , resultSet , resultContext , lastHandledCreation );
1082
- return ;
1083
- }
1084
-
1085
- if (rowValue != null && mappedStatement .isResultOrdered () && shouldProcessMoreRows (resultContext , rowBounds )) {
1079
+ } else if (rowValue != null && mappedStatement .isResultOrdered ()
1080
+ && shouldProcessMoreRows (resultContext , rowBounds )) {
1086
1081
storeObject (resultHandler , resultContext , rowValue , parentMapping , resultSet );
1087
1082
previousRowValue = null ;
1088
1083
} else if (rowValue != null ) {
0 commit comments