Class HostConnectionProvider
java.lang.Object
io.hypersistence.optimizer.core.event.persistence.HostConnectionProvider
- All Implemented Interfaces:
Serializable,org.hibernate.engine.jdbc.connections.spi.ConnectionProvider,org.hibernate.service.Service,org.hibernate.service.spi.Wrapped
public class HostConnectionProvider
extends Object
implements org.hibernate.engine.jdbc.connections.spi.ConnectionProvider
The
HostConnectionProvider delegates all JDBC connection handling to the host application's
ConnectionProvider, so that the short-lived SessionFactory used to generate the
event tables borrows connections from the very same pool as the application.
Crucially, it deliberately does not implement Stoppable.
When the temporary schema-generation ServiceRegistry is destroyed, Hibernate only calls
stop() on Stoppable services, so the host connection pool is never closed by us.
- Since:
- 2.14.0
- Author:
- Vlad Mihalcea
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionHostConnectionProvider(org.hibernate.engine.jdbc.connections.spi.ConnectionProvider delegate) -
Method Summary
Modifier and TypeMethodDescriptionvoidcloseConnection(Connection connection) booleanisUnwrappableAs(Class<?> unwrapType) boolean<T> T
-
Constructor Details
-
HostConnectionProvider
public HostConnectionProvider(org.hibernate.engine.jdbc.connections.spi.ConnectionProvider delegate)
-
-
Method Details
-
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
-
supportsAggressiveRelease
public boolean supportsAggressiveRelease()- Specified by:
supportsAggressiveReleasein interfaceorg.hibernate.engine.jdbc.connections.spi.ConnectionProvider
-
isUnwrappableAs
- Specified by:
isUnwrappableAsin interfaceorg.hibernate.service.spi.Wrapped
-
unwrap
- Specified by:
unwrapin interfaceorg.hibernate.service.spi.Wrapped
-