Top Description Fields Constructors Methods
org.hibernate.jpa.boot.spi

public final Class ProviderChecker

extends Object
Class Inheritance
Imports
java.util.Map, org.hibernate.cfg.AvailableSettings, org.hibernate.internal.HEMLogging, org.hibernate.jpa.HibernatePersistenceProvider, org.jboss.logging.Logger

Helper for handling checks to see whether Hibernate is the requested javax.persistence.spi.PersistenceProvider
Author
Steve Ebersole

Field Summary

Modifier and TypeField and Description
private static final Logger

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
private static String
extractProviderName(Map<K, V> integration)

private static String
public static String

Returns:

The extracted provider name, or null if none found.
extractRequestedProviderName
(PersistenceUnitDescriptor
The <persistence-unit/> descriptor.
persistenceUnit
,
Map<K, V>
The integration values.
integration
)

Extract the requested persistence provider name using the algorithm Hibernate uses.

public static boolean

Returns:

true if Hibernate should be the provider; false otherwise.
hibernateProviderNamesContain
(String
The requested provider name to check against the recognized Hibernate names.
requestedProviderName
)

Is the requested provider name one of the recognized Hibernate provider names?

public static boolean

Returns:

true if Hibernate should be the provider; false otherwise.
isProvider
(PersistenceUnitDescriptor
The <persistence-unit/> descriptor.
persistenceUnit
,
Map<K, V>
The integration values.
integration
)

Does the descriptor and/or integration request Hibernate as the javax.persistence.spi.PersistenceProvider?

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

logback to summary
private static final Logger log

Constructor Detail

ProviderCheckerback to summary
private ProviderChecker()

Method Detail

extractProviderNameback to summary
private static String extractProviderName(Map<K, V> integration)
extractProviderNameback to summary
private static String extractProviderName(PersistenceUnitDescriptor persistenceUnit)
extractRequestedProviderNameback to summary
public static String extractRequestedProviderName(PersistenceUnitDescriptor persistenceUnit, Map<K, V> integration)

Extract the requested persistence provider name using the algorithm Hibernate uses. Namely, a provider named in the 'integration' map (under the key 'javax.persistence.provider') is preferred, as per-spec, over value specified in persistence unit.

Parameters
persistenceUnit:PersistenceUnitDescriptor

The <persistence-unit/> descriptor.

integration:Map<K, V>

The integration values.

Returns:String

The extracted provider name, or null if none found.

hibernateProviderNamesContainback to summary
public static boolean hibernateProviderNamesContain(String requestedProviderName)

Is the requested provider name one of the recognized Hibernate provider names?

Parameters
requestedProviderName:String

The requested provider name to check against the recognized Hibernate names.

Returns:boolean

true if Hibernate should be the provider; false otherwise.

isProviderback to summary
public static boolean isProvider(PersistenceUnitDescriptor persistenceUnit, Map<K, V> integration)

Does the descriptor and/or integration request Hibernate as the javax.persistence.spi.PersistenceProvider? Note that in the case of no requested provider being named we assume we are the provider (the calls got to us somehow...)

Parameters
persistenceUnit:PersistenceUnitDescriptor

The <persistence-unit/> descriptor.

integration:Map<K, V>

The integration values.

Returns:boolean

true if Hibernate should be the provider; false otherwise.