org.springframework.orm.hibernate3

## Class TransactionAwareDataSourceConnectionProvider

- java.lang.Object
- - org.springframework.orm.hibernate3.LocalDataSourceConnectionProvider
  - - org.springframework.orm.hibernate3.TransactionAwareDataSourceConnectionProvider

- All Implemented Interfaces:
    org.hibernate.connection.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:
    `AbstractSessionFactoryBean.setUseTransactionAwareDataSource(boolean)`

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `TransactionAwareDataSourceConnectionProvider()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `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:
        `AbstractSessionFactoryBean.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 `org.hibernate.connection.ConnectionProvider`
      Overrides:
        `supportsAggressiveRelease` in class `LocalDataSourceConnectionProvider`