You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@geronimo.apache.org by "guillaume.nodet@worldonline.fr" <gu...@worldonline.fr> on 2005/09/15 13:55:36 UTC

Geronimo transactions and spring

I've run into one problem the past days when trying to use
spring transaction layer with geronimo transaction manager.
Spring has declarative transaction management, which is
basically the same as the ejb transactions management :
several attributes as supports, requiresNew...
The problem occurs when using the requiresNew attribute,
that should suspend the current transaction, begin a new
one, and after commit, resume the old transaction.
The problem is that spring JtaTransactionManager uses the
UserTransaction for begin / commit and TransactionManager
for suspend / resume. When a transaction that has been begun
with the UserTransaction, a call to suspend on the
TransactionManager will suspend the real transaction but not
the user transaction context, so that if a new transaction
is started it will fail saying that the previous transaction
has not been commited.

I tried to configure spring so that it uses only the
TransactionManager (automtically wrapped inside a
UserTransaction by spring) but the TransactionContextManager
is bypassed and jca (with GenericConnectionManager) does not
work any more because the context are not initialized.

So i wrote a simple facade on the OnlineUserTransaction that
implements both UserTransaction and TransactionManager to
work around all these problems (as done by Jotm for
example).  It seems to work but i'd like to know if there is
any drawbacks i missed.  Also, even if i have only tested
this inside a standalone spring app, i think the same things
should happen if spring is used inside a web app inside
geronimo.
So should i put this class in jencks or contribute it to
geronimo directly ?

Regards,
Guillaume Nodet

------------ ALICE HAUT DEBIT A 29,95 EUR/MOIS ------------
ALICEBOX, l'offre Internet tout en 1 : ADSL, téléphonie, modem Wi-Fi et en exclusivité
la hotline gratuite 24h/24 ! Soumis à conditions. Pour en profiter cliquez ici http://abonnement.aliceadsl.fr