org.springframework.orm.hibernate
Class LocalDataSourceConnectionProvider

java.lang.Object
  extended byorg.springframework.orm.hibernate.LocalDataSourceConnectionProvider
All Implemented Interfaces:
net.sf.hibernate.connection.ConnectionProvider

public class LocalDataSourceConnectionProvider
extends java.lang.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)

Field Summary
protected static java.lang.ThreadLocal configTimeDataSourceHolder
          This will hold the DataSource to use for the currently configured Hibernate SessionFactory.
 
Constructor Summary
LocalDataSourceConnectionProvider()
           
 
Method Summary
 void close()
           
 void closeConnection(java.sql.Connection conn)
           
 void configure(java.util.Properties props)
           
 java.sql.Connection getConnection()
           
 javax.sql.DataSource getDataSource()
          Return the DataSource that this ConnectionProvider wraps.
 boolean isStatementCache()
          Only used in Hibernate 2.0's ConnectionProvider.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

configTimeDataSourceHolder

protected static java.lang.ThreadLocal configTimeDataSourceHolder
This will hold the DataSource to use for the currently configured Hibernate SessionFactory. It will be set just before initialization of the respective SessionFactory, and reset immediately afterwards.

Constructor Detail

LocalDataSourceConnectionProvider

public LocalDataSourceConnectionProvider()
Method Detail

configure

public void configure(java.util.Properties props)
               throws net.sf.hibernate.HibernateException
Specified by:
configure in interface net.sf.hibernate.connection.ConnectionProvider
Throws:
net.sf.hibernate.HibernateException

getDataSource

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


getConnection

public java.sql.Connection getConnection()
                                  throws java.sql.SQLException
Specified by:
getConnection in interface net.sf.hibernate.connection.ConnectionProvider
Throws:
java.sql.SQLException

closeConnection

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

isStatementCache

public boolean isStatementCache()
Only used in Hibernate 2.0's ConnectionProvider.


close

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


Copyright (C) 2003-2004 The Spring Framework Project.