{"record":{"id":"42cdc3c69202a601","repo":"mybatis/mybatis-3","slug":"missing-resultmap-in-property-parameters-of","errorCode":null,"errorMessage":"Missing resultMap in property '{}'.  Parameters of type java.sql.ResultSet require a resultMap.","messagePattern":"Missing resultMap in property '(.+?)'\\.  Parameters of type java\\.sql\\.ResultSet require a resultMap\\.","errorType":"validation","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"src/main/java/org/apache/ibatis/mapping/ParameterMapping.java","lineNumber":115,"sourceCode":"\n    public Builder expression(String expression) {\n      parameterMapping.expression = expression;\n      return this;\n    }\n\n    public Builder value(Object value) {\n      parameterMapping.value = value;\n      return this;\n    }\n\n    public ParameterMapping build() {\n      validate();\n      return parameterMapping;\n    }\n\n    private void validate() {\n      if (ResultSet.class.equals(parameterMapping.javaType) && parameterMapping.resultMapId == null) {\n        throw new IllegalStateException(\"Missing resultMap in property '\" + parameterMapping.property + \"'.  \"\n            + \"Parameters of type java.sql.ResultSet require a resultMap.\");\n      }\n    }\n  }\n\n  public String getProperty() {\n    return property;\n  }\n\n  /**\n   * Used for handling output of callable statements.\n   *\n   * @return the mode\n   */\n  public ParameterMode getMode() {\n    return mode;\n  }\n","sourceCodeStart":97,"sourceCodeEnd":133,"githubUrl":"https://github.com/mybatis/mybatis-3/blob/008069adb1b089579b5dcba87ee591908b263274/src/main/java/org/apache/ibatis/mapping/ParameterMapping.java#L97-L133","documentation":"ParameterMapping.Builder.validate() throws IllegalStateException when a parameter is declared with javaType=java.sql.ResultSet (an OUT cursor of a stored procedure) but no resultMapId is set. ResultSet parameters need a resultMap so MyBatis knows how to map each row of the cursor; without one, mapping is undefined and the builder refuses.","triggerScenarios":"XML like <parameter property=\"curOut\" javaType=\"java.sql.ResultSet\" mode=\"OUT\"/> in a <select statementType=\"CALLABLE\"> statement without a resultMap=\"...\" attribute on the same statement; or ParameterMapping.Builder without .resultMapId(...) for a ResultSet javaType.","commonSituations":"Calling Oracle/PostgreSQL stored procedures returning REF CURSOR parameters; refactoring a statement and dropping the resultMap attribute; copy-paste of an IN-parameter mapping pattern onto a cursor OUT parameter.","solutions":["Add a resultMap attribute to the CALLABLE statement that defines the mapping for the cursor rows.","If building mappings programmatically, call .resultMapId(\"someResultMap\") on the ParameterMapping.Builder.","Verify the referenced resultMap id actually exists in the mapper to avoid the next failure downstream."],"exampleFix":"<!-- before -->\n<select statementType=\"CALLABLE\" parameterType=\"map\">\n  {call get_users(#{curOut,mode=OUT,javaType=java.sql.ResultSet})}\n</select>\n\n<!-- after -->\n<resultMap id=\"userMap\" type=\"User\">\n  <result property=\"id\" column=\"ID\"/>\n  <result property=\"name\" column=\"NAME\"/>\n</resultMap>\n<select statementType=\"CALLABLE\" parameterType=\"map\" resultMap=\"userMap\">\n  {call get_users(#{curOut,mode=OUT,javaType=java.sql.ResultSet})}\n</select>","handlingStrategy":"validation","validationCode":"// When building callable statement parameters programmatically\nif (ResultSet.class.equals(javaType) && resultMapId == null) {\n  throw new IllegalStateException(\"ResultSet parameter '\" + property + \"' needs a resultMap\");\n}\nnew ParameterMapping.Builder(config, property, javaType)\n    .mode(ParameterMode.OUT).resultMapId(resultMapId).build();","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Treat javaType=java.sql.ResultSet OUT parameters and resultMap as a pair — always write both.","Keep a project template for REF CURSOR calls to copy instead of hand-writing mappings.","Integration-test stored procedure mappings against a real database; XML validation will not catch this."],"tags":["mybatis","stored-procedure","cursor","result-map"],"backgroundTag":null,"analyzedSha":"008069adb1b089579b5dcba87ee591908b263274","analyzedAt":"2026-08-14T13:07:10.264Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}