{"record":{"id":"b5c123ec1c146830","repo":"mybatis/mybatis-3","slug":"error-getting-nested-result-map-values-for","errorCode":null,"errorMessage":"Error getting nested result map values for '{}'.  Cause: {}","messagePattern":"Error getting nested result map values for '(.+?)'\\.  Cause: (.+?)","errorType":"exception","errorClass":"ExecutorException","httpStatus":null,"severity":"error","filePath":"src/main/java/org/apache/ibatis/executor/resultset/DefaultResultSetHandler.java","lineNumber":1434,"sourceCode":"                linkObjects(metaObject, resultMapping, ancestorObject); // issue #385\n              }\n              continue;\n            }\n          }\n          final CacheKey rowKey = createRowKey(nestedResultMap, rsw, columnPrefix);\n          final CacheKey combinedKey = combineKeys(rowKey, parentRowKey);\n          Object rowValue = nestedResultObjects.get(combinedKey);\n          boolean knownValue = rowValue != null;\n          instantiateCollectionPropertyIfAppropriate(resultMapping, metaObject); // mandatory\n          if (anyNotNullColumnHasValue(resultMapping, columnPrefix, rsw)) {\n            rowValue = getRowValue(rsw, nestedResultMap, combinedKey, columnPrefix, rowValue);\n            if (rowValue != null && !knownValue) {\n              linkObjects(metaObject, resultMapping, rowValue);\n              foundValues = true;\n            }\n          }\n        } catch (SQLException e) {\n          throw new ExecutorException(\n              \"Error getting nested result map values for '\" + resultMapping.getProperty() + \"'.  Cause: \" + e, e);\n        }\n      }\n    }\n\n    // (issue #101)\n    if (resultMap.hasResultMapsUsingConstructorCollection()) {\n      foundValues = applyNestedPendingConstructorCreations(rsw, resultMap, metaObject, parentPrefix, parentRowKey,\n          newObject, foundValues);\n    }\n\n    return foundValues;\n  }\n\n  private String getColumnPrefix(String parentPrefix, ResultMapping resultMapping) {\n    final StringBuilder columnPrefixBuilder = new StringBuilder();\n    if (parentPrefix != null) {\n      columnPrefixBuilder.append(parentPrefix);","sourceCodeStart":1416,"sourceCodeEnd":1452,"githubUrl":"https://github.com/mybatis/mybatis-3/blob/008069adb1b089579b5dcba87ee591908b263274/src/main/java/org/apache/ibatis/executor/resultset/DefaultResultSetHandler.java#L1416-L1452","documentation":"A JDBC SQLException escaped while MyBatis read rows for a nested resultMap (an association or collection joined into the parent result). It is wrapped in an ExecutorException naming the property whose nested mapping failed, with the SQLException attached as cause. The mapping structure reached the JDBC layer; the driver then failed reading a value, so the real reason is in the cause.","triggerScenarios":"A resultMap with a nested <association>/<collection> resultMap; during getRowValue for the nested map a typeHandler.getResult(...) call throws SQLException — wrong column name, incompatible JDBC type conversion, exhausted stream, or driver-specific read error.","commonSituations":"Column alias typos in JOIN selects; missing typeHandler for an exotic column type inside a nested map; DB enum/json columns read with the wrong handler; driver cursor/streaming constraints on large nested result sets.","solutions":["Read the cause SQLException and fix what it points at (unknown column, cannot cast value, etc.).","Check the nested resultMap's <result column=\"...\"> names against the SELECT's actual (aliased) columns.","Register or specify a TypeHandler for the nested property's Java/JDBC type combination.","Reproduce the SELECT manually in a SQL client with the same aliases to confirm column names and types."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n  return session.selectList(\"selectAuthorWithPosts\");\n} catch (PersistenceException e) {\n  if (e.getMessage() != null && e.getMessage().contains(\"nested result map values\")) {\n    Throwable cause = e.getCause(); // SQLException with real driver reason\n    log.error(\"Nested mapping for property failed: {}\", cause == null ? \"?\" : cause.getMessage());\n  }\n  throw e;\n}","preventionTips":["Test nested resultMaps against the real schema in CI (column alias drift is the top cause).","Register explicit TypeHandlers for exotic column types used in nested maps.","Log the full cause chain in a central PersistenceException handler so driver details are never lost."],"tags":["mybatis","nested-results","jdbc","resultmap"],"backgroundTag":null,"analyzedSha":"008069adb1b089579b5dcba87ee591908b263274","analyzedAt":"2026-08-14T13:07:10.264Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}