Uploaded image for project: 'Cayenne'
  1. Cayenne
  2. CAY-2637

Allow forcing a custom Connection for a transaction

Agile BoardRank to TopRank to BottomAttach filesAttach ScreenshotBulk Copy AttachmentsBulk Move AttachmentsVotersWatch issueWatchersCreate sub-taskConvert to sub-taskLinkCloneLabelsUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Task
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 4.2.B1
    • None
    • None

    Description

      Just identified a use case where Cayenne transaction management API falls short.

      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.

      Attachments

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            ntimofeev Nikita Timofeev
            andrus Andrus Adamchik
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Time Tracking

              Estimated:
              Original Estimate - Not Specified
              Not Specified
              Remaining:
              Remaining Estimate - 0h
              0h
              Logged:
              Time Spent - 0.5h
              0.5h

              Slack

                Issue deployment