Class PersistenceXmlParser

java.lang.Object
org.hibernate.jpa.boot.spi.PersistenceXmlParser

public final class PersistenceXmlParser extends Object
Used by Hibernate to parse persistence.xml files in SE environments.
  • Method Details

    • create

      public static PersistenceXmlParser create()
      Returns:
      A PersistenceXmlParser using no settings at all.
    • create

      public static PersistenceXmlParser create(Map<?,?> integration)
      Parameters:
      integration - The Map of integration settings
      Returns:
      A PersistenceXmlParser using the provided settings.
    • create

      public static PersistenceXmlParser create(Map<?,?> integration, ClassLoader providedClassLoader, ClassLoaderService providedClassLoaderService)
      Parameters:
      integration - The Map of integration settings
      providedClassLoader - A class loader to use. Resources will be retrieved from this classloader in priority, before looking into classloaders mentioned in integration settings.
      providedClassLoaderService - A class loader service to use. Takes precedence over classloading settings in integration and over providedClassLoader.
      Returns:
      A PersistenceXmlParser using the provided settings and classloading configuration.
    • getClassLoaderService

      public ClassLoaderService getClassLoaderService()
      Returns:
      The ClassLoaderService used by this parser. Useful to retrieve URLs of persistence.xml files.
    • parse

      public Map<String,PersistenceUnitDescriptor> parse(List<URL> persistenceXmlUrls)
      Generic method to parse specified persistence.xml files and return a Map of descriptors for all discovered persistence-units keyed by the PU name.
      Parameters:
      persistenceXmlUrls - The URL of the persistence.xml files to parse
      Returns:
      Map of persistence-unit descriptors keyed by the PU name
    • parse

      public Map<String,PersistenceUnitDescriptor> parse(List<URL> persistenceXmlUrls, PersistenceUnitTransactionType transactionType)
      Generic method to parse specified persistence.xml files and return a Map of descriptors for all discovered persistence-units keyed by the PU name.
      Parameters:
      persistenceXmlUrls - The URLs of the persistence.xml files to parse
      transactionType - The specific PersistenceUnitTransactionType to incorporate into the persistence-unit descriptor
      Returns:
      Map of persistence-unit descriptors keyed by the PU name