org.springframework.orm.hibernate3
Class LocalDataSourceConnectionProvider

java.lang.Object
  extended by org.springframework.orm.hibernate3.LocalDataSourceConnectionProvider
Direct Known Subclasses:
LocalJtaDataSourceConnectionProvider, TransactionAwareDataSourceConnectionProvider

public class LocalDataSourceConnectionProvider
extends java.lang.Object

Hibernate connection provider for local DataSource instances in an application context. This provider will be used if LocalSessionFactoryBean's "dataSource" property is set without a Hibernate TransactionManagerLookup.

Since:
1.2
Author:
Juergen Hoeller
See Also:
AbstractSessionFactoryBean.setDataSource(javax.sql.DataSource)

Field Summary
private  javax.sql.DataSource dataSource
           
private  javax.sql.DataSource dataSourceToUse
           
 
Constructor Summary
LocalDataSourceConnectionProvider()
           
 
Method Summary
 void close()
          This implementation does nothing: We're dealing with an externally managed DataSource.
 void closeConnection(java.sql.Connection con)
          This implementation simply calls Connection.close.
 void configure(java.util.Properties props)
           
 java.sql.Connection getConnection()
          This implementation delegates to the underlying DataSource.
 javax.sql.DataSource getDataSource()
          Return the DataSource that this ConnectionProvider wraps.
protected  javax.sql.DataSource getDataSourceToUse(javax.sql.DataSource originalDataSource)
          Return the DataSource to use for retrieving Connections.
 boolean supportsAggressiveRelease()
          This implementation returns false: We cannot guarantee to receive the same Connection within a transaction, not even when dealing with a JNDI DataSource.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

dataSource

private javax.sql.DataSource dataSource

dataSourceToUse

private javax.sql.DataSource dataSourceToUse
Constructor Detail

LocalDataSourceConnectionProvider

public LocalDataSourceConnectionProvider()
Method Detail

configure

public void configure(java.util.Properties props)
               throws HibernateException
Throws:
HibernateException

getDataSourceToUse

protected javax.sql.DataSource getDataSourceToUse(javax.sql.DataSource originalDataSource)
Return the DataSource to use for retrieving Connections.

This implementation returns the passed-in DataSource as-is.

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)

getDataSource

public javax.sql.DataSource getDataSource()
Return the DataSource that this ConnectionProvider wraps.


getConnection

public java.sql.Connection getConnection()
                                  throws java.sql.SQLException
This implementation delegates to the underlying DataSource.

Throws:
java.sql.SQLException
See Also:
DataSource.getConnection()

closeConnection

public void closeConnection(java.sql.Connection con)
                     throws java.sql.SQLException
This implementation simply calls Connection.close.

Throws:
java.sql.SQLException
See Also:
Connection.close()

close

public void close()
This implementation does nothing: We're dealing with an externally managed DataSource.


supportsAggressiveRelease

public boolean supportsAggressiveRelease()
This implementation returns false: We cannot guarantee to receive the same Connection within a transaction, not even when dealing with a JNDI DataSource.