-
Notifications
You must be signed in to change notification settings - Fork 13k
Closed
Labels
bugno backward compatibilityIncludes change no backward compatibility for previous versionIncludes change no backward compatibility for previous version
Milestone
Description
Hi, I found some differences between XmlStatementBuilder and MapperAnnotationBuilder when they parse SQL statement, they will give some variables different values when user didn't set. Sometimes, it can cause different behaviors.
For example, here is some code from XMLStatementBuilder
void parseStatementNode() {
// other codes are omitted
String resultSetType = context.getStringAttribute("resultSetType");
ResultSetType resultSetTypeEnum = resolveResultSetType(resultSetType);
// omit some codes
builderAssistant.addMappedStatement(id, sqlSource, statementType, sqlCommandType,
fetchSize, timeout, parameterMap, parameterTypeClass, resultMap, resultTypeClass,
resultSetTypeEnum, flushCache, useCache, resultOrdered,
keyGenerator, keyProperty, keyColumn, databaseId, langDriver, resultSets);
}
// inherited from BaseBuilder
protected ResultSetType resolveResultSetType(String alias) {
if (alias == null) {
return null;
}
try {
return ResultSetType.valueOf(alias);
} catch (IllegalArgumentException e) {
throw new BuilderException("Error resolving ResultSetType. Cause: " + e, e);
}
}Here is some code from MapperAnnotationBuilder
void parseStatement(Method method) {
// omits unrelated codes
Options options = method.getAnnotation(Options.class);
ResultSetType resultSetType = ResultSetType.FORWARD_ONLY;
if (options != null) {
resultSetType = options.resultSetType();
}
}So we can see, users get different resultSetType value when they didn't set, one is null and the other is ResultSetType.FORWARD_ONLY. This may cause some different behaviors when others' code depend on the value.
MyBatis version
3.4.6
Metadata
Metadata
Assignees
Labels
bugno backward compatibilityIncludes change no backward compatibility for previous versionIncludes change no backward compatibility for previous version