Since the original issue resolved to be an application bug :-( I'd
nonetheless like to describe how I managed to achieve the TopLink integration for my
case. Maybe someone else is interested in this.
I've had a look at the Hibernate approach described by Jürgen. However it is
not fitting for me for the reason, that I'm not using standalone TopLink.
Rather TopLink is configured to be integrated on a JTS level into BEA WebLogic.
That means, WebLogic's JTA uses TopLink transactions under the hood.
The reason to extend JtaTransactionManager was therefore only, to have a
central point to access the active UnitOfWork for actually doing some
persistence-related work.
The approach is then as follows:
1. Extend initialization to create a TopLink Session
2. override lookupUserTransaction(). There I get the UserTransaction from
the superclass and return a wrapper around it which handles the assignment of
the active UnitOfWork in begin, commit and rollback. Additionally the Wrapper
class provides a means to retrieve the UnitOfWork.
The usage is then to assign the transaction manager declaratively to the DAO
which can then retrieve the active UnitOfWork to do its work. Actually the
transaction manager is passed only via an additional interface to prevent the
DAO implementation from meddling with transaction handling.
And finally: everything works so far.
Regards,
Andreas
P.S.: I'm rather sceptical about frameworks, but spring is really great.
|