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

Multiple Transactions: Migrate from Singleton pattern

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Open
    • Major
    • Resolution: Unresolved
    • None
    • Undefined future
    • Core Library
    • None

    Description

      Duplication from Dev-list:

      So.. I have several modules, each has own DomainConfig file and
      connection to it's DataBase. Sometimes there can be used different DB
      servers and even different DB types (usually it's Oracle and MS SQL,
      sometimes Sybase).

      Singletons:
      1) Configuration.getSharedConfiguration()
      This problem is solved:
      DefaultConfiguration conf = new DefaultConfiguration("module1-cayenne.xml");
      conf .initialize;
      conf.getDomain();
      //spend some time to find solution... everywhere examples with
      SharedConfiguration

      2)DataContext.getThreadLocal()
      Solved by own ThreadLocal for each module. (modules can work in one thread)
      //also spend some time

      3)Transaction.getThreadTransaction()
      this is killing one!!!
      using of own ThreadLocal doesn't help.
      It's hard-coded in performing Query to use this singleton
      Transaction.getThreadTransaction()
      And that is really huge problem for me.

      So me suggestion is to move this ThreadLocal to DataDomain. Still can
      use singleton API for standalone applications.
      Also we can move DataContext to DataDomain.

      Attachments

        Activity

          People

            Unassigned Unassigned
            apparition Evgeny Ryabitskiy
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated: