| A subclass of the standard Spring LocalDataSourceConnectionFactory (that supplies
OJB with connections to datasource defined in Spring) that wraps the connection in a
ByPassConnection so that the JTA defined in the managed environment can control the
transaction.
This class works in concert with the following parameter in the corresponding OJB properties
config:
ConnectionFactoryClass=org.kuali.rice.database.SpringConnectionFactoryManagedImpl
Apparently this strategy is not required in OJB 1.0.4:
http://db.apache.org/ojb/release-notes.txt
"ConnectionFactoryManagedImpl is declared deprecated. Now OJB automatic detect the
running JTA-transaction and suppress critical method calls on the used connection"
Details:
This is to overcome a shortcoming in Spring/OJB that in 1.03 you can't
run in a managed environment with Spring and OJB if Spring is giving OJB its Connections
through it's LocalDataSourceConnectionFactory (which doesn't wrap the connection in a bypass
connection). This is suppressing commits - so that JTA can do it.
If one uses JNDI to grab the DS this wouldn't be necessary because both
Spring and OJB would grab the DS from there and we'd be cool.
The ByPassConnection is a class that comes with OJB which essentially turns calls
to commit, rollback, etc. into NO-OPS. The reason it does this is because, in a
managed environment these methods are invoked on the individual connections by
the transaction manager and if you call the explicitly from the code they will
typically throw an exception (depending on the JTA implementation).
(what about TransactionAwareDataSourceConnectionFactory mentioned in Spring docs?)
|