Class ConnectionProviderInitiator
java.lang.Object
org.hibernate.engine.jdbc.connections.internal.ConnectionProviderInitiator
- All Implemented Interfaces:
StandardServiceInitiator<ConnectionProvider>
,ServiceInitiator<ConnectionProvider>
public class ConnectionProviderInitiator
extends Object
implements StandardServiceInitiator<ConnectionProvider>
Instantiates and configures an appropriate
ConnectionProvider
.-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final String
The strategy for agroal connection poolingstatic final String
The strategy for c3p0 connection poolingstatic final String
The strategy for hikari connection poolingstatic final ConnectionProviderInitiator
Singleton accessstatic final String
The strategy for oracle ucp connection pooling -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic void
consumeSetting
(Map<String, Object> settings, ConnectionProviderInitiator.SettingConsumer consumer, String... names) static Integer
extractIsolation
(Map<String, ?> settings) static String
extractSetting
(Map<String, Object> settings, String... names) static Properties
getConnectionProperties
(Map<String, Object> properties) Build the connection properties capable of being passed toDriverManager.getConnection(String, Properties)
forms takingProperties
argument.Obtains the service role initiated by this initiator.initiateService
(Map<String, Object> configurationValues, ServiceRegistryImplementor registry) Initiates the managed service.static Integer
interpretIsolation
(Object setting) static String
toIsolationConnectionConstantName
(Integer isolation) Gets theConnection
constant name corresponding to the given isolation.static String
toIsolationNiceName
(Integer isolation) Get the name of a JDBC transaction isolation level
-
Field Details
-
INSTANCE
Singleton access -
C3P0_STRATEGY
The strategy for c3p0 connection pooling- See Also:
-
HIKARI_STRATEGY
The strategy for hikari connection pooling- See Also:
-
UCP_STRATEGY
The strategy for oracle ucp connection pooling- See Also:
-
AGROAL_STRATEGY
The strategy for agroal connection pooling- See Also:
-
-
Constructor Details
-
ConnectionProviderInitiator
public ConnectionProviderInitiator()
-
-
Method Details
-
getServiceInitiated
Description copied from interface:ServiceInitiator
Obtains the service role initiated by this initiator. Should be unique within a registry- Specified by:
getServiceInitiated
in interfaceServiceInitiator<ConnectionProvider>
- Returns:
- The service role.
-
initiateService
public ConnectionProvider initiateService(Map<String, Object> configurationValues, ServiceRegistryImplementor registry) Description copied from interface:StandardServiceInitiator
Initiates the managed service.- Specified by:
initiateService
in interfaceStandardServiceInitiator<ConnectionProvider>
- Parameters:
configurationValues
- The configuration values in effectregistry
- The service registry. Can be used to locate services needed to fulfill initiation.- Returns:
- The initiated service.
-
getConnectionProperties
Build the connection properties capable of being passed toDriverManager.getConnection(String, Properties)
forms takingProperties
argument. We seek out all keys in the given map which start withhibernate.connection.
, using them to create a newProperties
instance. The keys in this newProperties
have thehibernate.connection.
prefix trimmed.- Parameters:
properties
- The map from which to build the connection specific properties.- Returns:
- The connection properties.
-
extractIsolation
-
interpretIsolation
-
toIsolationConnectionConstantName
Gets theConnection
constant name corresponding to the given isolation.- Parameters:
isolation
- The transaction isolation numeric value.- Returns:
- The corresponding Connection constant name.
- Throws:
HibernateException
- If the given isolation does not map to JDBC standard isolation- See Also:
-
toIsolationNiceName
Get the name of a JDBC transaction isolation level- Parameters:
isolation
- The transaction isolation numeric value.- Returns:
- a nice human-readable name
- See Also:
-
extractSetting
-
consumeSetting
public static void consumeSetting(Map<String, Object> settings, ConnectionProviderInitiator.SettingConsumer consumer, String... names)
-