[ https://issues.apache.org/jira/browse/CAY-2637?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17355043#comment-17355043 ]
Nikita Timofeev commented on CAY-2637: -------------------------------------- https://github.com/apache/cayenne/pull/460 > Allow forcing a custom Connection for a transaction > --------------------------------------------------- > > Key: CAY-2637 > URL: https://issues.apache.org/jira/browse/CAY-2637 > Project: Cayenne > Issue Type: Task > Reporter: Andrus Adamchik > Priority: Major > Fix For: 4.2.B1 > > > Just identified a use case where Cayenne transaction management API falls > short. > [DFLib|https://github.com/nhl/dflib] JDBCConnector allows manual transaction > management. I am using Cayenne with DFLib for a multi-step data > transformation process, with multiple commits within a transaction. Cayenne > queries should be able to include intermediate results flushed to DB (but > still not committed), so they need to run over the same Connection. > I was able to implement a custom solution that required wrapping both > DataSource and Transaction in custom classes. I think we can simplify this > for the end users. Some ideas: > * add the ability to pass an explicit DataSource (and/or Connection) to > TransactionDescriptor. Expand ServerRuntime.performInTransaction(..) to take > TransactionDescriptor (just like TransactionManager does). > * allow TransactionListener to provide its own connection, both in > "willAddConnection" (so it can wrap passed connection), or in a separate new > method that would allow to provide own Connection before Cayenne checks out > one from its own DataSource. -- This message was sent by Atlassian Jira (v8.3.4#803005)