public class LocalDataSourceConnectionProvider
extends java.lang.Object
AbstractSessionFactoryBean.setDataSource(javax.sql.DataSource)| Modifier and Type | Field and Description |
|---|---|
private javax.sql.DataSource |
dataSource |
private javax.sql.DataSource |
dataSourceToUse |
| Constructor and Description |
|---|
LocalDataSourceConnectionProvider() |
| Modifier and Type | Method and Description |
|---|---|
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. |
private javax.sql.DataSource dataSource
private javax.sql.DataSource dataSourceToUse
public void configure(java.util.Properties props)
throws HibernateException
HibernateExceptionprotected javax.sql.DataSource getDataSourceToUse(javax.sql.DataSource originalDataSource)
This implementation returns the passed-in DataSource as-is.
originalDataSource - the DataSource as configured by the user
on LocalSessionFactoryBeanAbstractSessionFactoryBean.setDataSource(javax.sql.DataSource)public javax.sql.DataSource getDataSource()
public java.sql.Connection getConnection()
throws java.sql.SQLException
java.sql.SQLExceptionDataSource.getConnection()public void closeConnection(java.sql.Connection con)
throws java.sql.SQLException
Connection.close.java.sql.SQLExceptionConnection.close()public void close()
public boolean supportsAggressiveRelease()
false: We cannot guarantee
to receive the same Connection within a transaction, not even when
dealing with a JNDI DataSource.