<div class="gmail_quote">On Wed, Apr 14, 2010 at 10:27 PM, Clint Popetz <span dir="ltr"><<a href="mailto:cpopetz@gmail.com">cpopetz@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div class="im">On Wed, Apr 14, 2010 at 9:08 PM, Dan Allen <<a href="mailto:dan.j.allen@gmail.com">dan.j.allen@gmail.com</a>> wrote:<br>
<br>
> Right. I'm imagining that we can inject the native UserTransaction interface<br>
> or our extended interface, but either way you are getting the same bean<br>
> instance. Internally we stick the our extended interface to keep the code<br>
> readable, the user gets a choice.<br>
> It's not just about wrapping these few status methods and adding the enlist<br>
> method. It's about taring the transaction API to a single interface.<br>
> Basically, UserTransaction is the interface, the implementation could be<br>
> non-JTA.<br>
<br>
<br>
</div>This is also important in mock environments. We use JTA in J2EE<br>
containers, but not in unit test land (or in development container<br>
environments like Jetty), and Seam's transaction API allows us to<br>
easily stub out the same API in the latter case.<br>
<font color="#888888"><font class="Apple-style-span" color="#000000"><font class="Apple-style-span" color="#888888"><br></font></font></font></blockquote><div>Truth be told, it's possible to swap out the JTA impl with a mock in a test environment even without our enhancement. CDI provides a UserTransaction bean in a container environment for injection. All beans can be overridden. Overriding is as simple as providing an @Alternative bean.</div>
<div><br></div><div>That also means we could have an @Alternative for each type of transaction we are supporting, but I'm still interested in extending the built-in bean anyway to have an enhanced interface because there are some other elements to the abstraction than just changing the UserTransaction impl.</div>
<div><br></div><div>-Dan</div><div> </div></div>-- <br>Dan Allen<br>Senior Software Engineer, Red Hat | Author of Seam in Action<br>Registered Linux User #231597<br><br><a href="http://mojavelinux.com">http://mojavelinux.com</a><br>
<a href="http://mojavelinux.com/seaminaction">http://mojavelinux.com/seaminaction</a><br><a href="http://www.google.com/profiles/dan.j.allen">http://www.google.com/profiles/dan.j.allen</a><br>