You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cayenne.apache.org by Evgeny Ryabitskiy <ev...@gmail.com> on 2009/12/01 14:31:04 UTC

Re: [jira] Created: (CAY-1322) Multiple Transactions: Migrate from Singleton pattern

Ok. Maybe I have little bit rushed :)


2009/12/1 Andrus Adamchik <an...@objectstyle.org>:
> I guess that's a bit premature. Let's figure out if there is a problem
> before opening a Jira. "Jiras" are "tasks", i.e. specific action items. So
> I'd rather we come to some consensus on what needs to be done firs, and then
> Jira action items.
>
> Andrus
>
> On Dec 1, 2009, at 2:50 PM, Evgeny Ryabitskiy (JIRA) wrote:
>
>> Multiple Transactions: Migrate from Singleton pattern
>> -----------------------------------------------------
>>
>>                Key: CAY-1322
>>                URL: https://issues.apache.org/jira/browse/CAY-1322
>>            Project: Cayenne
>>         Issue Type: New Feature
>>         Components: Cayenne Core Library
>>           Reporter: Evgeny Ryabitskiy
>>            Fix For: 3.1M1
>>
>>
>> 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.
>>
>> --
>> This message is automatically generated by JIRA.
>> -
>> You can reply to this email to add a comment to the issue online.
>>
>>
>
>