Class DataSourceBackedDialectFactory
java.lang.Object
io.helidon.integrations.cdi.hibernate.DataSourceBackedDialectFactory
- All Implemented Interfaces:
Serializable
,StandardServiceInitiator<DialectFactory>
,DialectFactory
,Service
,ServiceContributor
,ServiceInitiator<DialectFactory>
public final class DataSourceBackedDialectFactory
extends Object
implements DialectFactory, ServiceContributor, StandardServiceInitiator<DialectFactory>
A
DialectFactory
implementation (and a ServiceContributor
, and a StandardServiceInitiator<DialectFactory>
) that introspects DatabaseMetaData
from a configured DataSource
.
Hibernate is guaranteed to perform each of the following invocations, once, ever, in order:
- (The zero-argument constructor)
- The
contribute(StandardServiceRegistryBuilder)
method - The
initiateService(Map, ServiceRegistryImplementor)
method (if applicable)
Then, at application runtime, after the sole instance of this class has been installed following the protocol
above, Hibernate will call the buildDialect(Map, DialectResolutionInfoSource)
method as appropriate.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionbuildDialect
(Map<String, Object> settings, DialectResolutionInfoSource dialectResolutionInfoSource) Deprecated.For Hibernate use only.void
contribute
(StandardServiceRegistryBuilder standardServiceRegistryBuilder) Deprecated.For Hibernate use only.Deprecated.For Hibernate use only.initiateService
(Map<String, Object> settings, ServiceRegistryImplementor serviceRegistry) Deprecated.For Hibernate use only.
-
Constructor Details
-
DataSourceBackedDialectFactory
Deprecated.For use byServiceLoader
instances only.Creates a newDataSourceBackedDialectFactory
.
-
-
Method Details
-
buildDialect
@Deprecated public Dialect buildDialect(Map<String, Object> settings, DialectResolutionInfoSource dialectResolutionInfoSource) Deprecated.For Hibernate use only.Retrieves theDataSource
stored in the suppliedMap
under theAvailableSettings.JAKARTA_JTA_DATASOURCE
key, and uses it to ultimately acquire aDatabaseMetaData
instance to adapt into aDialectResolutionInfo
instance, such that aDialectResolutionInfoSource
can be constructed, in the case where the supplieddialectResolutionInfoSource
isnull
, and passes the resultingDialectResolutionInfoSource
to the standardDialectFactory
that Hibernate uses by default, such that Hibernate can determine whatDialect
to use when database connectivity is established via aMETA-INF/persistence.xml
'sjta-data-source
element.- Specified by:
buildDialect
in interfaceDialectFactory
- Parameters:
settings
- aMap
containing the settings returned by an invocation of theStandardServiceRegistryBuilder.getSettings()
method; must not benull
dialectResolutionInfoSource
- aDialectResolutionInfoSource
supplied by Hibernate; may be, and often is,null
- Returns:
- a
Dialect
; nevernull
- Throws:
NullPointerException
- ifsettings
isnull
HibernateException
- if aDialect
could not be constructed- See Also:
-
contribute
Deprecated.For Hibernate use only.Contributes thisDataSourceBackedDialectFactory
as aStandardServiceInitiator<DialectFactory>
if and only if certain requirements are met.This method will call
standardServiceRegistryBuilder.addInitiator(this)
if and only if all of the following preconditions hold:settings.get(
DIALECT
)
returns an object that is eithernull
or a blankString
settings.get(
JAKARTA_JTA_DATASOURCE
)
returns a non-null
DataSource
If any other state of affairs holds, this method takes no action.
- Specified by:
contribute
in interfaceServiceContributor
- Parameters:
standardServiceRegistryBuilder
- aStandardServiceRegistryBuilder
whoseStandardServiceRegistryBuilder.addInitiator(StandardServiceInitiator)
may be called withthis
as its sole argument; must not benull
-
getServiceInitiated
Deprecated.For Hibernate use only.ReturnsClass<DialectFactory>
when invoked, thus describing the type of service theinitiateService(Map, ServiceRegistryImplementor)
will initiate.- Specified by:
getServiceInitiated
in interfaceServiceInitiator<DialectFactory>
- Returns:
Class<DialectFactory>
when invoked- See Also:
-
initiateService
@Deprecated public DataSourceBackedDialectFactory initiateService(Map<String, Object> settings, ServiceRegistryImplementor serviceRegistry) Deprecated.For Hibernate use only.Returnsthis
when invoked.- Specified by:
initiateService
in interfaceStandardServiceInitiator<DialectFactory>
- Parameters:
settings
- ignoredserviceRegistry
- aServiceRegistryImplementor
supplied by Hibernate- Returns:
this
when invoked
-
ServiceLoader
instances only.