Top Description Fields Constructors Methods
org.hibernate.engine.jdbc.connections.internal

public Class DatasourceConnectionProviderImpl

extends Object
implements ConnectionProvider, Configurable, Stoppable
Class Inheritance
All Implemented Interfaces
org.hibernate.service.spi.Stoppable, org.hibernate.service.spi.Configurable, org.hibernate.engine.jdbc.connections.spi.ConnectionProvider, org.hibernate.service.spi.Wrapped, org.hibernate.service.Service, java.io.Serializable
Imports
java.sql.Connection, .SQLException, java.util.Map, javax.sql.DataSource, org.hibernate.HibernateException, org.hibernate.cfg.Environment, org.hibernate.engine.jdbc.connections.spi.ConnectionProvider, org.hibernate.engine.jndi.spi.JndiService, org.hibernate.service.UnknownUnwrapTypeException, org.hibernate.service.spi.Configurable, .InjectService, .Stoppable

A ConnectionProvider that manages connections from an underlying DataSource.

The DataSource to use may be specified by either:

Authors
Gavin King, Steve Ebersole

Field Summary

Modifier and TypeField and Description
private boolean
private DataSource
private JndiService
private String
private boolean
private String

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public void
closeConnection(Connection
The JDBC connection to release
connection
)

Implements org.hibernate.engine.jdbc.connections.spi.ConnectionProvider.closeConnection.

Release a connection from Hibernate use.
public void
configure(Map<String, Object>
The configuration properties.
configValues
)

Implements org.hibernate.service.spi.Configurable.configure.

Configure the service.
public Connection
getConnection()

Implements org.hibernate.engine.jdbc.connections.spi.ConnectionProvider.getConnection.

Obtains a connection for Hibernate use according to the underlying strategy of this provider.
public DataSource
public boolean
isUnwrappableAs(Class<?>
The type to check.
unwrapType
)

Implements org.hibernate.service.spi.Wrapped.isUnwrappableAs.

Can this wrapped service be unwrapped as the indicated type?
public void
public void
public void
stop()

Implements org.hibernate.service.spi.Stoppable.stop.

Stop phase notification
public boolean
supportsAggressiveRelease()

Implements org.hibernate.engine.jdbc.connections.spi.ConnectionProvider.supportsAggressiveRelease.

Does this connection provider support aggressive release of JDBC connections and later re-acquisition of those connections if needed?
public <T> T
unwrap(Class<T>
The java type as which to unwrap this instance.
unwrapType
)

Implements org.hibernate.service.spi.Wrapped.unwrap.

Unproxy the service proxy
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

availableback to summary
private boolean available
dataSourceback to summary
private DataSource dataSource
jndiServiceback to summary
private JndiService jndiService
passback to summary
private String pass
useCredentialsback to summary
private boolean useCredentials
userback to summary
private String user

Constructor Detail

DatasourceConnectionProviderImplback to summary
public DatasourceConnectionProviderImpl()

Method Detail

closeConnectionback to summary
public void closeConnection(Connection connection) throws SQLException

Implements org.hibernate.engine.jdbc.connections.spi.ConnectionProvider.closeConnection.

Doc from org.hibernate.engine.jdbc.connections.spi.ConnectionProvider.closeConnection.

Release a connection from Hibernate use.

Parameters
connection:Connection

The JDBC connection to release

Annotations
@Override
Exceptions
SQLException:
Indicates a problem closing the connection
configureback to summary
public void configure(Map<String, Object> configValues)

Implements org.hibernate.service.spi.Configurable.configure.

Doc from org.hibernate.service.spi.Configurable.configure.

Configure the service.

Parameters
configValues:Map<String, Object>

The configuration properties.

Annotations
@Override
getConnectionback to summary
public Connection getConnection() throws SQLException

Implements org.hibernate.engine.jdbc.connections.spi.ConnectionProvider.getConnection.

Doc from org.hibernate.engine.jdbc.connections.spi.ConnectionProvider.getConnection.

Obtains a connection for Hibernate use according to the underlying strategy of this provider.

Returns:Connection

The obtained JDBC connection

Annotations
@Override
Exceptions
SQLException:
Indicates a problem opening a connection
getDataSourceback to summary
public DataSource getDataSource()
isUnwrappableAsback to summary
public boolean isUnwrappableAs(Class<?> unwrapType)

Implements org.hibernate.service.spi.Wrapped.isUnwrappableAs.

Doc from org.hibernate.service.spi.Wrapped.isUnwrappableAs.

Can this wrapped service be unwrapped as the indicated type?

Parameters
unwrapType:Class<?>

The type to check.

Returns:boolean

True/false.

Annotations
@Override
setDataSourceback to summary
public void setDataSource(DataSource dataSource)
setJndiServiceback to summary
public void setJndiService(JndiService jndiService)
Annotations
@InjectService
required:false
@SuppressWarnings:UnusedDeclaration
stopback to summary
public void stop()

Implements org.hibernate.service.spi.Stoppable.stop.

Doc from org.hibernate.service.spi.Stoppable.stop.

Stop phase notification

Annotations
@Override
supportsAggressiveReleaseback to summary
public boolean supportsAggressiveRelease()

Implements org.hibernate.engine.jdbc.connections.spi.ConnectionProvider.supportsAggressiveRelease.

Doc from org.hibernate.engine.jdbc.connections.spi.ConnectionProvider.supportsAggressiveRelease.

Does this connection provider support aggressive release of JDBC connections and later re-acquisition of those connections if needed?

This is used in conjunction with org.hibernate.ConnectionReleaseMode#AFTER_STATEMENT to aggressively release JDBC connections. However, the configured ConnectionProvider must support re-acquisition of the same underlying connection for that semantic to work.

Typically, this is only true in managed environments where a container tracks connections by transaction or thread. Note that JTA semantic depends on the fact that the underlying connection provider does support aggressive release.

Returns:boolean

true if aggressive releasing is supported; false otherwise.

Annotations
@Override
unwrapback to summary
public <T> T unwrap(Class<T> unwrapType)

Implements org.hibernate.service.spi.Wrapped.unwrap.

Doc from org.hibernate.service.spi.Wrapped.unwrap.

Unproxy the service proxy

Parameters
unwrapType:Class<T>

The java type as which to unwrap this instance.

Returns:T

The unwrapped reference

Annotations
@Override
@SuppressWarnings:unchecked