站内搜索: 请输入搜索关键词
当前页面: 在线文档首页 > Spring Framework 1.2.9 API 文档英文版

LocalDataSourceConnectionProvider (Spring Framework) - Spring Framework 1.2.9 API 文档英文版


org.springframework.orm.hibernate
Class LocalDataSourceConnectionProvider

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

public class LocalDataSourceConnectionProvider
extends Object
implements net.sf.hibernate.connection.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 net.sf.hibernate.HibernateException
Specified by:
configure in interface net.sf.hibernate.connection.ConnectionProvider
Throws:
net.sf.hibernate.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 net.sf.hibernate.connection.ConnectionProvider
Throws:
SQLException

closeConnection

public void closeConnection(Connection con)
                     throws SQLException
Specified by:
closeConnection in interface net.sf.hibernate.connection.ConnectionProvider
Throws:
SQLException

close

public void close()
Specified by:
close in interface net.sf.hibernate.connection.ConnectionProvider


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