You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user-java@ibatis.apache.org by Abdullah Kauchali <ab...@isanusi.com> on 2005/10/20 12:53:51 UTC

Switching from local to global Transactions at runtime?

(Been out of the loop for a while ... so apologies for stupid question.)

Is it possible to switch the transactional properties from local to global
at runtime?

Are there any good examples I can use?

I am aware that the SqlMapClient, when created, relates to one of the
following transactional types:

1)  Local
2)  Global (JTA)
3)  External (???)

Basically, what we're trying to do is create the ability to weave method
calls at runtime.  Suppose we have two methods that update database 1.
This operates with a local transaction manager.

Now, at runtime, we can weave a third method (which updates database 2)
along with the first two - but we still want transactional support (this 
time
obviously across the two databases!).

So, we want to switch from local to global at runtime.

Any ideas how we can achieve this?

Many thanks in advance & kind regards,

Abdullah

Re: Switching from local to global Transactions at runtime?

Posted by Abdullah Kauchali <ab...@isanusi.com>.
Clinton Begin wrote:

>
> Well, as much as I'd like to just tell you how bad of an idea that is, 
> I'll tell you how to do this... :-)
>
Thanks.  LOL.

> My recommendation would be to have two SqlMapClient instances....and 
> two SqlMapConfig.xml files (one configured for global, one for local).
>
> Switching between the two would simply mean using the appropriate 
> instance. 
>
I suspected as much ... I've had it exactly like that, but wasn't sure.  
Let me see if I get the desired
fission reaction and if I can break some expensive equipment with 
that.   :)
(All for a good cause, I assure you.)

Gimme a few hours, I'll post more detail about what we have in mind.

> That's the safest way to do it.
>
> Cheers,
> Clinton
>
Thanks Clinton!  :)


Re: Switching from local to global Transactions at runtime?

Posted by Clinton Begin <cl...@gmail.com>.
Well, as much as I'd like to just tell you how bad of an idea that is, I'll
tell you how to do this... :-)

My recommendation would be to have two SqlMapClient instances....and two
SqlMapConfig.xml files (one configured for global, one for local).

Switching between the two would simply mean using the appropriate instance.

That's the safest way to do it.

Cheers,
Clinton

On 10/20/05, Abdullah Kauchali <ab...@isanusi.com> wrote:
>
> (Been out of the loop for a while ... so apologies for stupid question.)
>
> Is it possible to switch the transactional properties from local to global
> at runtime?
>
> Are there any good examples I can use?
>
> I am aware that the SqlMapClient, when created, relates to one of the
> following transactional types:
>
> 1) Local
> 2) Global (JTA)
> 3) External (???)
>
> Basically, what we're trying to do is create the ability to weave method
> calls at runtime. Suppose we have two methods that update database 1.
> This operates with a local transaction manager.
>
> Now, at runtime, we can weave a third method (which updates database 2)
> along with the first two - but we still want transactional support (this
> time
> obviously across the two databases!).
>
> So, we want to switch from local to global at runtime.
>
> Any ideas how we can achieve this?
>
> Many thanks in advance & kind regards,
>
> Abdullah
>