org.springframework.orm.hibernate
Class LocalDataSourceConnectionProvider

java.lang.Object
  extended by org.springframework.orm.hibernate.LocalDataSourceConnectionProvider
All Implemented Interfaces:
ConnectionProvider
Direct Known Subclasses:
TransactionAwareDataSourceConnectionProvider

public class LocalDataSourceConnectionProvider
extends Object
implements ConnectionProvider

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

Since:
11.07.2003
Author:
Juergen Hoeller
See Also:
LocalSessionFactoryBean.setDataSource(javax.sql.DataSource)

Constructor Summary
LocalDataSourceConnectionProvider()
           
 
Method Summary
 void close()
           
 void closeConnection(Connection con)
           
 void configure(Properties props)
           
 Connection getConnection()
           
 DataSource getDataSource()
          Return the DataSource that this ConnectionProvider wraps.
protected  DataSource getDataSourceToUse(DataSource originalDataSource)
          Return the DataSource to use for retrieving Connections.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LocalDataSourceConnectionProvider

public LocalDataSourceConnectionProvider()
Method Detail

configure

public void configure(Properties props)
               throws HibernateException
Specified by:
configure in interface ConnectionProvider
Throws:
HibernateException

getDataSourceToUse

protected DataSource getDataSourceToUse(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:
LocalSessionFactoryBean.setDataSource(javax.sql.DataSource)

getDataSource

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


getConnection

public Connection getConnection()
                         throws SQLException
Specified by:
getConnection in interface ConnectionProvider
Throws:
SQLException

closeConnection

public void closeConnection(Connection con)
                     throws SQLException
Specified by:
closeConnection in interface ConnectionProvider
Throws:
SQLException

close

public void close()
Specified by:
close in interface ConnectionProvider


Copyright (c) 2002-2005 The Spring Framework Project.