Federico Mariani created CAMEL-26991:
----------------------------------------
Summary: camel-sql: outputType=StreamList ignores the route
transaction and the template options
Key: CAMEL-26991
URL: https://issues.apache.org/jira/browse/CAMEL-26991
Project: Camel
Issue Type: Bug
Components: camel-sql
Affects Versions: 4.18.5, 4.23.0, 4.22.2
Reporter: Federico Mariani
Fix For: 4.24.0
With {{outputType=StreamList}} the sql producer takes a connection from the
DataSource itself instead of going through the JdbcTemplate. In a transacted
route the query runs outside the transaction, so it does not see the rows
written earlier in that transaction, and the {{template.*}} options
({{maxRows}}, {{fetchSize}}, {{queryTimeout}}) are ignored. With the
{{CamelSqlDataSource}} header the {{template.*}} options are ignored for every
output type.
{code:java}
from("direct:start").transacted()
.to("sql:insert into projects values (99, 'TX', 'ASF')")
.to("sql:select * from projects where id = 99?outputType=StreamList")
.split(body()).streaming().to("mock:row"); // 0 rows, no error
{code}
{{sql:select * from projects?outputType=StreamList&template.maxRows=1}} streams
all the rows.
Expected: StreamList gets and releases its connection with Spring's
{{DataSourceUtils}}, as the other output types do, so it uses the connection of
the transaction (without closing it), and it applies the template settings. The
header keeps the template options of the endpoint.
_Claude Code on behalf of Federico Mariani_
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)