Class ProviderChecker


  • public final class ProviderChecker
    extends java.lang.Object
    Helper for handling checks to see whether Hibernate is the requested PersistenceProvider
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.lang.String extractRequestedProviderName​(PersistenceUnitDescriptor persistenceUnit, java.util.Map integration)
      Extract the requested persistence provider name using the algorithm Hibernate uses.
      static boolean hibernateProviderNamesContain​(java.lang.String requestedProviderName)
      Is the requested provider name one of the recognized Hibernate provider names?
      static boolean isProvider​(PersistenceUnitDescriptor persistenceUnit, java.util.Map integration)
      Does the descriptor and/or integration request Hibernate as the PersistenceProvider? Note that in the case of no requested provider being named we assume we are the provider (the calls got to us somehow...)
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • isProvider

        public static boolean isProvider​(PersistenceUnitDescriptor persistenceUnit,
                                         java.util.Map integration)
        Does the descriptor and/or integration request Hibernate as the 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 - The <persistence-unit/> descriptor.
        integration - The integration values.
        Returns:
        true if Hibernate should be the provider; false otherwise.
      • hibernateProviderNamesContain

        public static boolean hibernateProviderNamesContain​(java.lang.String requestedProviderName)
        Is the requested provider name one of the recognized Hibernate provider names?
        Parameters:
        requestedProviderName - The requested provider name to check against the recognized Hibernate names.
        Returns:
        true if Hibernate should be the provider; false otherwise.
      • extractRequestedProviderName

        public static java.lang.String extractRequestedProviderName​(PersistenceUnitDescriptor persistenceUnit,
                                                                    java.util.Map 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 - The <persistence-unit/> descriptor.
        integration - The integration values.
        Returns:
        The extracted provider name, or null if none found.