Class TopiaConnectionProvider

java.lang.Object
org.nuiton.topia.persistence.internal.TopiaConnectionProvider
All Implemented Interfaces:
Serializable, org.hibernate.engine.jdbc.connections.spi.ConnectionProvider, org.hibernate.service.Service, org.hibernate.service.spi.Configurable, org.hibernate.service.spi.Stoppable, org.hibernate.service.spi.Wrapped

public class TopiaConnectionProvider extends Object implements org.hibernate.engine.jdbc.connections.spi.ConnectionProvider, org.hibernate.service.spi.Configurable, org.hibernate.service.spi.Stoppable

Customized connection provider.

This provider fix the following bug : http://nuiton.org/issues/show/561

To use this connection provider, add this property to topia configuration
 config.setProperty(Environment.CONNECTION_PROVIDER, TopiaConnectionProvider.class.getName());
 
or in a properties file :
 hibernate.connection.provider_class=org.nuiton.topia.persistence.internal.TopiaConnectionProvider
 
Since:
2.5.3
Author:
Tony Chemit - chemit@codelutin.com
See Also:
  • Field Details

    • url

      protected String url
      JDBC url of connection. This is a mandatory hibernate configuration vi the property JdbcSettings.JAKARTA_JDBC_URL.
    • connectionProps

      protected Properties connectionProps
      All grabbed connection properties
    • isolation

      protected Integer isolation
      Sql isolation level to use in connection. Can be configured by hibernate property JdbcSettings.ISOLATION.
      See Also:
    • autocommit

      protected boolean autocommit
      auto commit connection state. Can be configured by hibernate property JdbcSettings.AUTOCOMMIT.
      See Also:
    • poolSize

      protected int poolSize
      Size of connection pool. By default use 20, can be specify by using the hibernate configuration property JdbcSettings.POOL_SIZE.
    • pool

      protected final List<Connection> pool
      Our pool of connections which are not closed and availables.
  • Constructor Details

    • TopiaConnectionProvider

      public TopiaConnectionProvider()
  • Method Details

    • configure

      public void configure(Map configurationValues) throws org.hibernate.HibernateException
      Specified by:
      configure in interface org.hibernate.service.spi.Configurable
      Throws:
      org.hibernate.HibernateException
    • getConnection

      public Connection getConnection() throws SQLException
      Specified by:
      getConnection in interface org.hibernate.engine.jdbc.connections.spi.ConnectionProvider
      Throws:
      SQLException
    • closeConnection

      public void closeConnection(Connection conn) throws SQLException
      Specified by:
      closeConnection in interface org.hibernate.engine.jdbc.connections.spi.ConnectionProvider
      Throws:
      SQLException
    • finalize

      protected void finalize() throws Throwable
      Overrides:
      finalize in class Object
      Throws:
      Throwable
    • stop

      public void stop()
      Specified by:
      stop in interface org.hibernate.service.spi.Stoppable
    • supportsAggressiveRelease

      public boolean supportsAggressiveRelease()
      Specified by:
      supportsAggressiveRelease in interface org.hibernate.engine.jdbc.connections.spi.ConnectionProvider
    • getUrl

      public String getUrl()
    • getConnectionProps

      public Properties getConnectionProps()
    • getIsolation

      public Integer getIsolation()
    • getPool

      public List<Connection> getPool()
    • getPoolSize

      public int getPoolSize()
    • isAutocommit

      public boolean isAutocommit()
    • isUnwrappableAs

      public boolean isUnwrappableAs(Class unwrapType)
      Specified by:
      isUnwrappableAs in interface org.hibernate.service.spi.Wrapped
    • unwrap

      public <T> T unwrap(Class<T> unwrapType)
      Specified by:
      unwrap in interface org.hibernate.service.spi.Wrapped