On Tue, Nov 24, 2009 at 6:35 PM, Boscarine, Steven
<Steven.Boscarine(a)childrens.harvard.edu> wrote:
How is the UserTransaction you're mentioning different than the
one Spring provides?
http://static.springsource.org/spring/docs/3.0.x/spring-framework-referen...
Well, here's the difference.
The JTA UserTransaction is defined by the JTA specification, and is
supported by all real Java transaction managers. It's an abstraction
that can accommodate just about any kind of transactional resource you
can think of. It works perfectly with JDBC, JCA, JPA, Hibernate, JDO,
etc.
The Spring transaction manager is a totally proprietary API that ties
your application to Spring, and provides an abstraction of ... other
abstractions. It's a totally bogus, superfluous layer that provides no
additional resource independence, nor additional high-level semantics,
than what is already provided by JTA.
If I wanted to continue making the world a better place by following
in the footsteps of Spring, I would create a new transaction
abstraction called WeldTransaction, which abstracts your application
away from the underlying Spring or JTA transaction. Of course, then
you would probably want to write your own transaction manager to
abstract away from your choice of WeldTransaction, Spring or JTA for
transaction management. This is pretty easy to do, since all these
interfaces have the same three methods: begin(), commit() and
rollback(). If you do this, you might want to consider contributing
your work back to the Spring framework, so that all Spring users can
benefit from your abstraction of our abstraction of their abstraction
of JTA.
--
Gavin King
gavin.king(a)gmail.com
http://in.relation.to/Bloggers/Gavin
http://hibernate.org
http://seamframework.org