public class LocalDataSourceConnectionProvider extends Object implements org.hibernate.connection.ConnectionProvider
AbstractSessionFactoryBean.setDataSource(javax.sql.DataSource)
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(Connection con)
This implementation simply calls
Connection.close . |
void |
configure(Properties props) |
Connection |
getConnection()
This implementation delegates to the underlying DataSource.
|
DataSource |
getDataSource()
Return the DataSource that this ConnectionProvider wraps.
|
protected DataSource |
getDataSourceToUse(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. |
public void configure(Properties props) throws org.hibernate.HibernateException
configure
in interface org.hibernate.connection.ConnectionProvider
org.hibernate.HibernateException
protected DataSource getDataSourceToUse(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 DataSource getDataSource()
public Connection getConnection() throws SQLException
getConnection
in interface org.hibernate.connection.ConnectionProvider
SQLException
DataSource.getConnection()
public void closeConnection(Connection con) throws SQLException
Connection.close
.closeConnection
in interface org.hibernate.connection.ConnectionProvider
SQLException
Connection.close()
public void close()
close
in interface org.hibernate.connection.ConnectionProvider
public boolean supportsAggressiveRelease()
false
: We cannot guarantee
to receive the same Connection within a transaction, not even when
dealing with a JNDI DataSource.supportsAggressiveRelease
in interface org.hibernate.connection.ConnectionProvider
Copyright © 2014. All Rights Reserved.