public class DefaultSpringJdbcConnectionHandler extends Object implements SpringJdbcConnectionHandler
SpringJdbcConnectionHandler
, which uses DataSourceUtils
to obtain and release a
Spring-managed transactional connection.JdbcConnectionHandler.ConnectionType
Constructor and Description |
---|
DefaultSpringJdbcConnectionHandler() |
Modifier and Type | Method and Description |
---|---|
Connection |
getConnection(DataSource dataSource,
JdbcConnectionHandler.ConnectionType connectionType)
Get a
Connection using given DataSource . |
void |
releaseConnection(Connection connection,
DataSource dataSource,
JdbcConnectionHandler.ConnectionType connectionType)
Release given
connection , performing any connection finalization operation (for example to close the
connection). |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
create
public Connection getConnection(DataSource dataSource, JdbcConnectionHandler.ConnectionType connectionType) throws SQLException
JdbcConnectionHandler
Connection
using given DataSource
.getConnection
in interface JdbcConnectionHandler
dataSource
- The DataSource
from which to obtain connectionsconnectionType
- Connection type to discern if the connection will be used for initialization or for normal
JDBC operationsnull
SQLException
- If an error occurred and the connection cannot be providedpublic void releaseConnection(Connection connection, DataSource dataSource, JdbcConnectionHandler.ConnectionType connectionType) throws SQLException
JdbcConnectionHandler
connection
, performing any connection finalization operation (for example to close the
connection).releaseConnection
in interface JdbcConnectionHandler
connection
- The connection to releasedataSource
- The DataSource
from which the connection was obtainedconnectionType
- Connection type to discern if the connection was used for initialization or for normal JDBC
operationsSQLException
- If an error occurred and the connection cannot be releasedCopyright © 2020 The Holon Platform. All rights reserved.