-
Notifications
You must be signed in to change notification settings - Fork 38.6k
Closed
Labels
in: dataIssues in data modules (jdbc, orm, oxm, tx)Issues in data modules (jdbc, orm, oxm, tx)type: regressionA bug that is also a regressionA bug that is also a regression
Milestone
Description
This is a simple unit test which passes with the 5.3.x
but fails with the current 6.0
milestones:
@Test
void namedParamMapReference() {
String insert = "insert into foos (id) values (:headers[id])";
class Foo {
final Map<String, Object> headers = new HashMap<>();
public Foo() {
this.headers.put("id", UUID.randomUUID());
}
public Map<String, Object> getHeaders() {
return this.headers;
}
}
Foo foo = new Foo();
Object[] params =
NamedParameterUtils.buildValueArray(NamedParameterUtils.parseSqlStatement(insert),
new BeanPropertySqlParameterSource(foo), null);
assertThat(params[0]).isEqualTo(foo.getHeaders().get("id"));
}
The point is that we may have a reference for the value from nested Map
property.
The typical use case is messaging, for example with Spring Integration, where a Message<?>
in the request is used as a source for parameter values.
We even advertise this in the docs: https://docs.spring.io/spring-integration/docs/current/reference/html/jdbc.html#jdbc-outbound-channel-adapter.
I suspect that the cause for breaking change is this fix: 64b6bee. Or the previous one: 86eda27.
Thanks
Metadata
Metadata
Assignees
Labels
in: dataIssues in data modules (jdbc, orm, oxm, tx)Issues in data modules (jdbc, orm, oxm, tx)type: regressionA bug that is also a regressionA bug that is also a regression