com.holonplatform.jdbc.spring.internal

## Class DefaultSpringJdbcConnectionHandler

- java.lang.Object
- - com.holonplatform.jdbc.spring.internal.DefaultSpringJdbcConnectionHandler

- All Implemented Interfaces:
    JdbcConnectionHandler, SpringJdbcConnectionHandler

      public class DefaultSpringJdbcConnectionHandler
      extends Object
      implements SpringJdbcConnectionHandler

  Default `SpringJdbcConnectionHandler`, which uses `DataSourceUtils` to obtain and release a Spring-managed transactional connection.
  Since:
    5.1.0

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from interface com.holonplatform.jdbc.JdbcConnectionHandler

      `JdbcConnectionHandler.ConnectionType`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `DefaultSpringJdbcConnectionHandler()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    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).

    - ### Methods inherited from class java.lang.Object

      `equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

    - ### Methods inherited from interface com.holonplatform.jdbc.spring.SpringJdbcConnectionHandler

      `create`

- - ### Constructor Detail

    - #### DefaultSpringJdbcConnectionHandler

          public DefaultSpringJdbcConnectionHandler()

  - ### Method Detail

    - #### getConnection

          public Connection getConnection(DataSource dataSource,
                                          JdbcConnectionHandler.ConnectionType connectionType)
                                   throws SQLException

      Description copied from interface: `JdbcConnectionHandler`
      Get a `Connection` using given `DataSource`.
      Specified by:
        `getConnection` in interface `JdbcConnectionHandler`
      Parameters:
        `dataSource` - The `DataSource` from which to obtain connections
        `connectionType` - Connection type to discern if the connection will be used for initialization or for normal JDBC operations
      Returns:
        A connection, which must be not `null`
      Throws:
        `SQLException` - If an error occurred and the connection cannot be provided

    - #### releaseConnection

          public void releaseConnection(Connection connection,
                                        DataSource dataSource,
                                        JdbcConnectionHandler.ConnectionType connectionType)
                                 throws SQLException

      Description copied from interface: `JdbcConnectionHandler`
      Release given `connection`, performing any connection finalization operation (for example to close the connection).
      Specified by:
        `releaseConnection` in interface `JdbcConnectionHandler`
      Parameters:
        `connection` - The connection to release
        `dataSource` - The `DataSource` from which the connection was obtained
        `connectionType` - Connection type to discern if the connection was used for initialization or for normal JDBC operations
      Throws:
        `SQLException` - If an error occurred and the connection cannot be released

Copyright © 2019 The Holon Platform. All rights reserved.