Skip to content

Commit 8e2df26

Browse files
committed
fixes #1496 columnPrefix specified in constructor mapping should be converted to uppercase. Otherwise, auto-mapping in the referenced result map does not find the matching column.
1 parent 4b91bc7 commit 8e2df26

File tree

2 files changed

+2
-3
lines changed

2 files changed

+2
-3
lines changed

src/main/java/org/apache/ibatis/executor/resultset/DefaultResultSetHandler.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -632,7 +632,7 @@ Object createParameterizedResultObject(ResultSetWrapper rsw, Class<?> resultType
632632
value = getNestedQueryConstructorValue(rsw.getResultSet(), constructorMapping, columnPrefix);
633633
} else if (constructorMapping.getNestedResultMapId() != null) {
634634
final ResultMap resultMap = configuration.getResultMap(constructorMapping.getNestedResultMapId());
635-
value = getRowValue(rsw, resultMap, constructorMapping.getColumnPrefix());
635+
value = getRowValue(rsw, resultMap, getColumnPrefix(columnPrefix, constructorMapping));
636636
} else {
637637
final TypeHandler<?> typeHandler = constructorMapping.getTypeHandler();
638638
value = typeHandler.getResult(rsw.getResultSet(), prependPrefix(column, columnPrefix));

src/test/java/org/apache/ibatis/submitted/constructor_columnprefix/Mapper.xml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<!--
33
4-
Copyright 2009-2018 the original author or authors.
4+
Copyright 2009-2019 the original author or authors.
55
66
Licensed under the Apache License, Version 2.0 (the "License");
77
you may not use this file except in compliance with the License.
@@ -31,7 +31,6 @@
3131
<resultMap id="authorRM"
3232
type="org.apache.ibatis.submitted.constructor_columnprefix.Author">
3333
<id property="id" column="id" />
34-
<result property="name" column="name" />
3534
</resultMap>
3635

3736
<resultMap id="articleRM"

0 commit comments

Comments
 (0)