mybatis/mybatis-3 · error · BuilderException
Error resolving ResultSetType. Cause: {cause}
Error message
Error resolving ResultSetType. Cause: {cause} What it means
BaseBuilder.resolveResultSetType() maps a string like resultSetType="FORWARD_ONLY" to the java.sql.ResultSetType-compatible enum via valueOf(). An unrecognized or misspelled value aborts mapper/config parsing with this BuilderException.
Source
Thrown at src/main/java/org/apache/ibatis/builder/BaseBuilder.java:79
protected Set<String> stringSetValueOf(String value, String defaultValue) {
value = value == null ? defaultValue : value;
return new HashSet<>(Arrays.asList(value.split(",")));
}
protected JdbcType resolveJdbcType(String alias) {
try {
return alias == null ? null : JdbcType.valueOf(alias);
} catch (IllegalArgumentException e) {
throw new BuilderException("Error resolving JdbcType. Cause: " + e, e);
}
}
protected ResultSetType resolveResultSetType(String alias) {
try {
return alias == null ? null : ResultSetType.valueOf(alias);
} catch (IllegalArgumentException e) {
throw new BuilderException("Error resolving ResultSetType. Cause: " + e, e);
}
}
protected ParameterMode resolveParameterMode(String alias) {
try {
return alias == null ? null : ParameterMode.valueOf(alias);
} catch (IllegalArgumentException e) {
throw new BuilderException("Error resolving ParameterMode. Cause: " + e, e);
}
}
protected Object createInstance(String alias) {
Class<?> clazz = resolveClass(alias);
try {
return clazz == null ? null : clazz.getDeclaredConstructor().newInstance();
} catch (Exception e) {
throw new BuilderException("Error creating instance. Cause: " + e, e);
}View on GitHub (pinned to 008069adb1)
Solutions
- Use exactly FORWARD_ONLY, SCROLL_INSENSITIVE, or SCROLL_SENSITIVE (upper case)
- If you need vendor scroll behavior, configure it on the driver/statement level instead
Example fix
<!-- before --> <select id="x" resultSetType="SCROLL">...</select> <!-- after --> <select id="x" resultSetType="SCROLL_INSENSITIVE">...</select>
Defensive patterns
Strategy: validation
Validate before calling
static final Set<String> VALID = Set.of("FORWARD_ONLY", "SCROLL_INSENSITIVE", "SCROLL_SENSITIVE");
// validate before writing config or generating XML Prevention
- Only the three standard scroll constants are accepted; check them against java.sql.ResultSet constants
- Validate generated XML in CI by parsing with a test SqlSessionFactory
When it happens
Trigger: resultSetType="scroll insensitive" or a vendor-specific scroll mode instead of one of FORWARD_ONLY, SCROLL_INSENSITIVE, SCROLL_SENSITIVE; wrong case like "forward_only".
Common situations: Copying JDBC constant names from driver docs; hand-editing mapper XML scroll settings for large-result streaming.
Related errors
- Error resolving JdbcType. Cause: {cause}
- Error creating instance. Cause: {cause}
- Error resolving class. Cause: {cause}
- Type {typeHandlerType} is not a valid TypeHandler because it
- Invalid bound statement (not found): {mapperInterface}.{meth
AI-assisted analysis of mybatis/mybatis-3@008069adb1 (2026-08-14).
Data as JSON: /api/errors/981d64aa2c5a423f.
Report an issue: GitHub.