Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 0 additions & 32 deletions .travis.yml

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package org.apache.ibatis.executor.result;

public class ResultClassTypeHolder {

// hold the the class type of result
private static final ThreadLocal<Class> resultTypeTl = new ThreadLocal();

public static void setResultType(Class clazz) {
resultTypeTl.set(clazz);
}

public static Class getResultType() {
return resultTypeTl.get();
}

public static void clean() {
resultTypeTl.remove();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
import org.apache.ibatis.executor.parameter.ParameterHandler;
import org.apache.ibatis.executor.result.DefaultResultContext;
import org.apache.ibatis.executor.result.DefaultResultHandler;
import org.apache.ibatis.executor.result.ResultClassTypeHolder;
import org.apache.ibatis.executor.result.ResultMapException;
import org.apache.ibatis.mapping.BoundSql;
import org.apache.ibatis.mapping.Discriminator;
Expand Down Expand Up @@ -293,6 +294,7 @@ private void validateResultMapsCount(ResultSetWrapper rsw, int resultMapCount) {

private void handleResultSet(ResultSetWrapper rsw, ResultMap resultMap, List<Object> multipleResults, ResultMapping parentMapping) throws SQLException {
try {
ResultClassTypeHolder.setResultType(resultMap.getType());
if (parentMapping != null) {
handleRowValues(rsw, resultMap, null, RowBounds.DEFAULT, parentMapping);
} else {
Expand All @@ -307,6 +309,7 @@ private void handleResultSet(ResultSetWrapper rsw, ResultMap resultMap, List<Obj
} finally {
// issue #228 (close resultsets)
closeResultSet(rsw.getResultSet());
ResultClassTypeHolder.clean();
}
}

Expand Down