You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/JdbcMessageHandlerIntegrationTests.java
+43-1Lines changed: 43 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,5 @@
1
1
/*
2
-
* Copyright 2002-2017 the original author or authors.
2
+
* Copyright 2002-2018 the original author or authors.
3
3
*
4
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
5
* you may not use this file except in compliance with the License.
@@ -19,6 +19,8 @@
19
19
importstaticorg.junit.Assert.assertEquals;
20
20
importstaticorg.junit.Assert.assertTrue;
21
21
22
+
importjava.util.Arrays;
23
+
importjava.util.List;
22
24
importjava.util.Map;
23
25
importjava.util.concurrent.atomic.AtomicBoolean;
24
26
@@ -88,6 +90,24 @@ public void testSimpleDynamicInsert() {
Copy file name to clipboardExpand all lines: src/reference/asciidoc/jdbc.adoc
+9-1Lines changed: 9 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -261,7 +261,15 @@ public MessageHandler jdbcMessageHandler(DataSource dataSource) {
261
261
====
262
262
263
263
From the XML configuration perspective, the `prepared-statement-setter` attribute is available on the `<int-jdbc:outbound-channel-adapter>` component.
264
-
It lets you specify a `MessagePreparedStatementSetter` bean reference.
264
+
It lets you specify a `MessagePreparedStatementSetter` bean reference.
265
+
266
+
==== Batch Update
267
+
268
+
Starting with version 5.1, the `JdbcMessageHandler` performs a `JdbcOperations.batchUpdate()` if the payload of the request message is an `Iterable` instance.
269
+
Each element of the `Iterable` is wrapped to a `Message` with the headers from the request message.
270
+
In the case of regular `SqlParameterSourceFactory`-based configuration these messages are used to build an `SqlParameterSource[]` for an argument used in the mentioned `JdbcOperations.batchUpdate()` function.
271
+
When a `MessagePreparedStatementSetter` configuration is applied, a `BatchPreparedStatementSetter` variant is used to iterate over those messages for each item and the provided `MessagePreparedStatementSetter` is called against them.
272
+
The batch update is not supported when `keysGenerated` mode is selected.
Copy file name to clipboardExpand all lines: src/reference/asciidoc/whats-new.adoc
+2Lines changed: 2 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -109,6 +109,8 @@ See <<amqp-content-type>> for more information.
109
109
110
110
A confusing `max-rows-per-poll` property on the JDBC Inbound Channel Adapter and JDBC Outbound Gateway has been deprecated in favor of the newly introduced `max-rows` property.
111
111
112
+
The `JdbcMessageHandler` supports now a `batchUpdate` functionality when the payload of the request message is an instance of an `Iterable` type.
0 commit comments