Skip to content

Commit f801726

Browse files
committed
Minor adjustments for cases where constructor mapping does not use actual constructor
1 parent be848e4 commit f801726

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/main/java/org/apache/ibatis/builder/ResultMappingConstructorResolver.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,10 @@ public List<ResultMapping> resolveWithConstructor() {
9898
final List<ConstructorMetaInfo> matchingConstructorCandidates = retrieveConstructorCandidates(
9999
constructorResultMappings.size());
100100

101+
if (matchingConstructorCandidates.isEmpty()) {
102+
return constructorResultMappings;
103+
}
104+
101105
// extract the property names we have
102106
final Set<String> constructorArgsByName = constructorResultMappings.stream().map(ResultMapping::getProperty)
103107
.filter(Objects::nonNull).collect(Collectors.toCollection(LinkedHashSet::new));
@@ -123,11 +127,9 @@ public List<ResultMapping> resolveWithConstructor() {
123127
+ ". Note that 'javaType' is required when there is ambiguous constructors or there is no writable property with the same name ('name' is optional, BTW). There is more info in the debug log.");
124128
} else {
125129
if (log.isDebugEnabled()) {
126-
log.debug("Constructor for '" + resultMapId
127-
+ "' could not be resolved, continuing, but this may result in a mapping exception later");
130+
log.debug("Constructor for '" + resultMapId + "' could not be resolved.");
128131
}
129-
// return un-modified original mappings (maybe have this as a config flag, as this will result in a runtime
130-
// exception eventually
132+
// return un-modified original mappings
131133
return constructorResultMappings;
132134
}
133135
}

0 commit comments

Comments
 (0)