The Spring Framework

org.springframework.orm.hibernate3
Class TransactionAwareDataSourceConnectionProvider

java.lang.Object
  extended by org.springframework.orm.hibernate3.LocalDataSourceConnectionProvider
      extended by org.springframework.orm.hibernate3.TransactionAwareDataSourceConnectionProvider
All Implemented Interfaces:
ConnectionProvider

public class TransactionAwareDataSourceConnectionProvider
extends LocalDataSourceConnectionProvider

Subclass of LocalDataSourceConnectionProvider that returns a transaction-aware proxy for the exposed DataSource. Used if LocalSessionFactoryBean's "useTransactionAwareDataSource" flag is on.

Since:
1.2
Author:
Juergen Hoeller
See Also:
LocalSessionFactoryBean.setUseTransactionAwareDataSource(boolean)

Constructor Summary
TransactionAwareDataSourceConnectionProvider()
           
 
Method Summary
protected  DataSource getDataSourceToUse(DataSource originalDataSource)
          Return a TransactionAwareDataSourceProxy for the given DataSource, provided that it isn't a TransactionAwareDataSourceProxy already.
 boolean supportsAggressiveRelease()
          This implementation returns true: We can guarantee to receive the same Connection within a transaction, as we are exposing a TransactionAwareDataSourceProxy.
 
Methods inherited from class org.springframework.orm.hibernate3.LocalDataSourceConnectionProvider
close, closeConnection, configure, getConnection, getDataSource
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TransactionAwareDataSourceConnectionProvider

public TransactionAwareDataSourceConnectionProvider()
Method Detail

getDataSourceToUse

protected DataSource getDataSourceToUse(DataSource originalDataSource)
Return a TransactionAwareDataSourceProxy for the given DataSource, provided that it isn't a TransactionAwareDataSourceProxy already.

Overrides:
getDataSourceToUse in class LocalDataSourceConnectionProvider
Parameters:
originalDataSource - the DataSource as configured by the user on LocalSessionFactoryBean
Returns:
the DataSource to actually retrieve Connections from (potentially wrapped)
See Also:
LocalSessionFactoryBean.setDataSource(javax.sql.DataSource)

supportsAggressiveRelease

public boolean supportsAggressiveRelease()
This implementation returns true: We can guarantee to receive the same Connection within a transaction, as we are exposing a TransactionAwareDataSourceProxy.

Specified by:
supportsAggressiveRelease in interface ConnectionProvider
Overrides:
supportsAggressiveRelease in class LocalDataSourceConnectionProvider

The Spring Framework

Copyright © 2002-2007 The Spring Framework.