[seam-dev] Implementing REQUIRES_NEW for seam transaction management

Denis Forveille denis.forveille at gmail.com
Mon Aug 31 14:57:03 EDT 2009


2009/8/31 Dan Allen <dan.j.allen at gmail.com>:
> On Wed, Aug 26, 2009 at 8:55 PM, Stuart Douglas
> <stuart at baileyroberts.com.au> wrote:
>>
>> I would like to implement REQUIRES_NEW as a transaction type for the
>> @Transactional annotation. My basic plan is:
>>
>> - Create a TransactionManager component that can be installed into
>> components.xml, and give the option to configure the JNDI location of
>> the JTA TransactionManager.
>>
>> - modify the Work.workInTransaction method to check if the existing
>> transaction need to be suspended, as if so use the TransactionManager
>> component to suspend and resume the transaction.
>>
>> I can't help thinking that there is some problem with this approach,
>> otherwise someone else would have already done it.
>
> Try it, create some tests and if it works, prove it.
>
>>
>> I also know that TransactionManager is not supposed to be used by the
>> application, does anyone know if this will cause problems?
>
> Spring has been doing this for a long time. It's of course app server
> dependent, but the general feeling is that using it is so common to consider
> it a public API.
>
WebSphere v6.x/v7.x does not expose its TransactionManager as it is
not part of the J2EE contract.
For hibernate, have a look at the
org.hibernate.transaction.WebSphereExtendedJTATransactionLookup class
to have an idea how they access it (in a non supported way..)
I don't know how Spring did it, maybe look at
org.springframework.transaction.jta.WebSphereUowTransactionManager
>>
>> I would also like to implement the ability to control seam global
>> transactions based on a flag in pages.xml, so they can be disabled for
>> specific views. Would anyone have any objections to this?
>
> I've always been in favor of this idea.
>
> -Dan
>
> --
> Dan Allen
> Senior Software Engineer, Red Hat | Author of Seam in Action
> Registered Linux User #231597
>
> http://mojavelinux.com
> http://mojavelinux.com/seaminaction
> http://in.relation.to/Bloggers/Dan
>
> _______________________________________________
> seam-dev mailing list
> seam-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/seam-dev
>
>


More information about the seam-dev mailing list