I had a long email typed up, but in short:
Users can decide to use the transaction object as a UserTransaction, or they can use it as a SeamTransaction (or whatever it ends up being called) and get the extra features -- the name of this design pattern is eluding me, but I think it fits well here.
This alleviates the extra step of injecting the UserTransaction, then injecting the utility (or instantiating it) and passing the UserTransaction in to get the desired behavior.
Two+ steps reduced to one. I'm with Dan here.
--Lincoln
By "client", I am referring to other modules (and in rarer cases the developer's application). A use case would probably help here.On Wed, Apr 14, 2010 at 2:25 PM, Pete Muir <pmuir@redhat.com> wrote:What interface does the client reference in their code?
On 14 Apr 2010, at 19:21, Dan Allen wrote:
> On Wed, Apr 14, 2010 at 9:13 AM, Pete Muir <pmuir@redhat.com> wrote:
> I'm with Emmanuel here.
>
> All of this is addressable through an Transactions utiltiy class.
>
> Let me ask for two clarifications that will help me understand the counter argument.
>
> 1. If this transaction wrapper extends UserTransaction, is that worse/different than having a utility class? You can always inject the native type, or inject the wrapper for the extra convenient status methods.
> 2. The transaction wrapper allows us reuse the UserTransaction API to address JTA, resource-local and potentially spring transaction APIs as one. The client then doesn't concern itself with which transaction API is being used under the covers, but everyone "speaks" JTA UserTransaction. How do we do that with just a utility class?
I think you are confusing two concepts.
The Faces module needs to provide the Seam-managed transactions that tie into the JSF lifecycle. (Let's call them "lifecycle transactions" rather than the term "global", which I have used in the past). That integration needs to get a handle on the transaction API. We don't want to tie ourselves to the native JTA UserTransaction or else we put environments without JTA out in the cold (e.g., servlet containers).What I am proposing a producer method that grabs the transaction of choice (defaulting to JTA if it's available), wraps it inside of an object that implements JTA UserTransaction with some extra convenience methods (the status and enlist methods we previously discussed), and returns it. The Faces module can then use this extended UserTransaction to interact with whatever transaction API is being used under the covers.This model worked well for us in Seam 2. I'm trying to understand why we are rescinding on our past decisions.-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://www.google.com/profiles/dan.j.allen
_______________________________________________
seam-dev mailing list
seam-dev@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/seam-dev