当前页面:
在线文档首页 >
Spring Framework 1.2.9 API 文档英文版
TransactionAwareDataSourceConnectionFactory (Spring Framework) - Spring Framework 1.2.9 API 文档英文版
org.springframework.orm.ojb.support
Class TransactionAwareDataSourceConnectionFactory
java.lang.Object
org.apache.ojb.broker.accesslayer.ConnectionFactoryAbstractImpl
org.apache.ojb.broker.accesslayer.ConnectionFactoryNotPooledImpl
org.apache.ojb.broker.accesslayer.ConnectionFactoryManagedImpl
org.springframework.orm.ojb.support.LocalDataSourceConnectionFactory
org.springframework.orm.ojb.support.TransactionAwareDataSourceConnectionFactory
- All Implemented Interfaces:
- org.apache.ojb.broker.accesslayer.ConnectionFactory
public class TransactionAwareDataSourceConnectionFactory
- extends LocalDataSourceConnectionFactory
Subclass of LocalDataSourceConnectionFactory that returns transaction-aware
proxies for all DataSources retrieved by OJB.
Define the following entry in your OJB.properties to use this connection factory:
ConnectionFactoryClass=org.springframework.orm.ojb.support.TransactionAwareDataSourceConnectionFactory
This connection factory allows Spring's OJB access to participate in JDBC-based
transactions managed outside of OJB (for example, by Spring's DataSourceTransactionManager).
This can be convenient if you need a different local transaction strategy for another O/R
mapping tool, for example, but still want OJB access to join into those transactions.
A further benefit of this factory is that plain PersistenceBrokers
(opened directly via the PersistenceBrokerFactory, outside of Spring's OJB support)
will still participate in active Spring-managed transactions.
As a further effect, using a transaction-aware DataSource will apply remaining
transaction timeouts to all created JDBC Statements. This means that all operations
performed by OJB will automatically participate in Spring-managed transaction timeouts.
This is even desirable for transactions managed by PersistenceBrokerTransactionManager.
- Since:
- 1.1.4
- Author:
- Juergen Hoeller
- See Also:
TransactionAwareDataSourceProxy
,
DataSourceTransactionManager
,
PersistenceBrokerTransactionManager
Method Summary |
protected DataSource |
getDataSource(String jcdAlias)
Return a TransactionAwareDataSourceProxy for the original DataSource
(i.e. the Spring bean with the JCD alias name), provided that it
isn't a TransactionAwareDataSourceProxy already. |
Methods inherited from class org.apache.ojb.broker.accesslayer.ConnectionFactoryManagedImpl |
newConnectionFromDriverManager |
Methods inherited from class org.apache.ojb.broker.accesslayer.ConnectionFactoryNotPooledImpl |
checkOutJdbcConnection, releaseJdbcConnection, validateConnection |
Methods inherited from class org.apache.ojb.broker.accesslayer.ConnectionFactoryAbstractImpl |
getDbURL, getJcdDescription, getJdbcProperties, getJdbcProperties, initializeJdbcConnection, newConnectionFromDataSource, releaseAllResources, releaseConnection |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
TransactionAwareDataSourceConnectionFactory
public TransactionAwareDataSourceConnectionFactory()
getDataSource
protected DataSource getDataSource(String jcdAlias)
- Return a TransactionAwareDataSourceProxy for the original DataSource
(i.e. the Spring bean with the JCD alias name), provided that it
isn't a TransactionAwareDataSourceProxy already.
- Overrides:
getDataSource
in class LocalDataSourceConnectionFactory
- Parameters:
jcdAlias
- the JCD alias to retrieve a DataSource for
- Returns:
- the DataSource to use
Copyright (c) 2002-2007 The Spring Framework Project.