users@glassfish.java.net

Re: how to obtain a TransactionManager in a servlet?

From: legolas wood <legolas.w_at_gmail.com>
Date: Fri, 20 Apr 2007 19:00:29 +0430

Hi,
Is it impossible to get TranactionManager in a servlet or it is
meaningless?

I thought TranactionManager can help us to see whether we are inside a
UserTransaction or not.
For example objectA.methodA calls objectB.methodB and it call
objectC.methodC.
Now i want to know wheter any of methodA or methodB start a
userTransaction or not.
I think i can do it using TransactionManager.


Thanks



Sanjeeb Kumar Sahoo wrote:
> Hi Legolas,
>
> Instead of injecting TranactionManager, inject a UserTransaction
> object like this:
> @Resource private javax.transaction.UserTranaction utx;
>
> Now you can use utx to control transaction boundaries.
>
> Thanks,
> Sahoo
>
> legolas wood wrote:
>> Hi
>> Thank you for reading my post
>> I have tried to obtain a transaction manager using
>>
>> @Resource TransactionManager txm;
>>
>> and it does not work, can you tell me how i can create a
>> TranasactionManager object in my servlet?
>>
>> Thanks