站内搜索: 请输入搜索关键词
当前页面: 在线文档首页 > 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
  extended by org.apache.ojb.broker.accesslayer.ConnectionFactoryAbstractImpl
      extended by org.apache.ojb.broker.accesslayer.ConnectionFactoryNotPooledImpl
          extended by org.apache.ojb.broker.accesslayer.ConnectionFactoryManagedImpl
              extended by org.springframework.orm.ojb.support.LocalDataSourceConnectionFactory
                  extended by 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

Field Summary
 
Fields inherited from class org.springframework.orm.ojb.support.LocalDataSourceConnectionFactory
beanFactory
 
Constructor Summary
TransactionAwareDataSourceConnectionFactory()
           
 
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.springframework.orm.ojb.support.LocalDataSourceConnectionFactory
lookupConnection
 
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
 

Constructor Detail

TransactionAwareDataSourceConnectionFactory

public TransactionAwareDataSourceConnectionFactory()
Method Detail

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.