Hi!

Kirk True wrote:
> Is there any way that an arbitrary class can participate in a transaction?
> What I'm looking for is the equivalent of the SessionSynchronization class,
> but more generic so that it can be used outside of an EJB environment by any
> old arbitrary class. I'm thinking that such an object can register itself as
> a transaction "listener", and then provide methods within itself to handle
> the rollback and commit methods. That way a client that uses such a class
> doesn't have to worry about handling the rollback and commit functionality
> for that object, and the client can be sure that the object is consistent.
<snip>

javax.transaction.Synchronization should do the trick. Get the TM from
JNDI by doing new InitialContext().lookup("TransactionManager"), and do
getTransaction().registerSynchronization(myOldArbitrayObject), where the
mOAO implements the Synch interface.

Should work. If it doesn't that could indicate a bug in the TM.

/Rickard

-- 
Rickard �berg

Email: [EMAIL PROTECTED]
http://www.telkel.com
http://www.jboss.org
http://www.dreambean.com

Reply via email to