You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "Zheng Feng (JIRA)" <ji...@apache.org> on 2019/05/16 06:16:00 UTC
[jira] [Created] (CAMEL-13529) camel-jdbc - Improve to work with
the spring Tx Manager
Zheng Feng created CAMEL-13529:
----------------------------------
Summary: camel-jdbc - Improve to work with the spring Tx Manager
Key: CAMEL-13529
URL: https://issues.apache.org/jira/browse/CAMEL-13529
Project: Camel
Issue Type: Improvement
Components: camel-jdbc
Reporter: Zheng Feng
currently the camel-jdbc does not work correctly with the spring [DataSourceTransactionManager|https://docs.spring.io/spring-framework/docs/current/javadoc-api/org/springframework/jdbc/datasource/DataSourceTransactionManager.html]
{noformat}
Application code is required to retrieve the JDBC Connection via DataSourceUtils.getConnection(DataSource) instead of a standard Java EE-style DataSource.getConnection() call. Spring classes such as JdbcTemplate use this strategy implicitly. If not used in combination with this transaction manager, the DataSourceUtils lookup strategy behaves exactly like the native DataSource lookup; it can thus be used in a portable fashion.
{noformat}
So we have to add the extra dependency on the spring-jdbc to support to work with the spring Tx Manager by replacing to use DataSourceUtils.getConnection(DataSource).
Quote from [~davsclaus]
{noformat}
Well in light of that using transactions with spring TX managers and JDBC seems to not work together, then its limited.
So yeah I think its an okay trade-off to have that extra set of dependencies to make it work well with both Spring and I assume also plain JEE. If not we can add an option to use either the spring datasource lookup or the current approach. However I would be puzzled if that spring-jdbc didn't work OOTB with JEE API too.
{noformat}
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)