Package org.nuiton.topia.framework
Class TopiaConnectionProvider
java.lang.Object
org.nuiton.topia.framework.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.framework.TopiaConnectionProvider
- Since:
- 2.5.3
- Author:
- tchemit <chemit@codelutin.com>
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected booleanauto commit connection state.protected PropertiesAll grabbed connection propertiesprotected IntegerSql isolation level to use in connection.protected final List<Connection>Our pool of connections which are not closed and availables.protected intSize of connection pool.protected StringJDBC url of connection. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidcloseConnection(Connection conn) voidprotected voidfinalize()getPool()intgetUrl()booleanbooleanisUnwrappableAs(Class unwrapType) voidstop()boolean<T> T
-
Field Details
-
url
JDBC url of connection. This is a mandatory hibernate configuration vi the propertyAvailableSettings.URL. -
connectionProps
All grabbed connection properties -
isolation
Sql isolation level to use in connection. Can be configured by hibernate propertyAvailableSettings.ISOLATION.- See Also:
-
autocommit
protected boolean autocommitauto commit connection state. Can be configured by hibernate propertyAvailableSettings.AUTOCOMMIT.- See Also:
-
poolSize
protected int poolSizeSize of connection pool. By default use20, can be specify by using the hibernate configuration propertyAvailableSettings.POOL_SIZE. -
pool
Our pool of connections which are not closed and availables.
-
-
Constructor Details
-
TopiaConnectionProvider
public TopiaConnectionProvider()
-
-
Method Details
-
configure
- Specified by:
configurein interfaceorg.hibernate.service.spi.Configurable- Throws:
org.hibernate.HibernateException
-
getConnection
- Specified by:
getConnectionin interfaceorg.hibernate.engine.jdbc.connections.spi.ConnectionProvider- Throws:
SQLException
-
closeConnection
- Specified by:
closeConnectionin interfaceorg.hibernate.engine.jdbc.connections.spi.ConnectionProvider- Throws:
SQLException
-
finalize
-
stop
public void stop()- Specified by:
stopin interfaceorg.hibernate.service.spi.Stoppable
-
supportsAggressiveRelease
public boolean supportsAggressiveRelease()- Specified by:
supportsAggressiveReleasein interfaceorg.hibernate.engine.jdbc.connections.spi.ConnectionProvider
-
getUrl
-
getConnectionProps
-
getIsolation
-
getPool
-
getPoolSize
public int getPoolSize() -
isAutocommit
public boolean isAutocommit() -
isUnwrappableAs
- Specified by:
isUnwrappableAsin interfaceorg.hibernate.service.spi.Wrapped
-
unwrap
- Specified by:
unwrapin interfaceorg.hibernate.service.spi.Wrapped
-