Class PersistenceXmlParser

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

public class PersistenceXmlParser extends Object
Used by Hibernate to parse persistence.xml files in SE environments.
Author:
Steve Ebersole
  • Constructor Details

  • Method Details

    • locatePersistenceUnits

      public static List<ParsedPersistenceXmlDescriptor> locatePersistenceUnits(Map integration)
      Find all persistence-units from all accessible META-INF/persistence.xml resources
      Parameters:
      integration - The Map of integration settings
      Returns:
      List of descriptors for all discovered persistence-units.
    • locateIndividualPersistenceUnit

      public static ParsedPersistenceXmlDescriptor locateIndividualPersistenceUnit(URL persistenceXmlUrl)
      Parse a specific persistence.xml with the assumption that it defines a single persistence-unit.
      Parameters:
      persistenceXmlUrl - The persistence.xml URL
      Returns:
      The single persistence-unit descriptor
    • locateIndividualPersistenceUnit

      public static ParsedPersistenceXmlDescriptor locateIndividualPersistenceUnit(URL persistenceXmlUrl, Map integration)
      Parse a specific persistence.xml with the assumption that it defines a single persistence-unit.
      Parameters:
      persistenceXmlUrl - The persistence.xml URL
      integration - The Map of integration settings
      Returns:
      The single persistence-unit descriptor
    • locateIndividualPersistenceUnit

      public static ParsedPersistenceXmlDescriptor locateIndividualPersistenceUnit(URL persistenceXmlUrl, PersistenceUnitTransactionType transactionType, Map integration)
      Parse a specific persistence.xml with the assumption that it defines a single persistence-unit.
      Parameters:
      persistenceXmlUrl - The persistence.xml URL
      transactionType - The specific PersistenceUnitTransactionType to incorporate into the persistence-unit descriptor
      integration - The Map of integration settings
      Returns:
      The single persistence-unit descriptor
    • locateNamedPersistenceUnit

      public static ParsedPersistenceXmlDescriptor locateNamedPersistenceUnit(URL persistenceXmlUrl, String name)
      Parse a specific persistence.xml and return the descriptor for the persistence-unit with matching name
      Parameters:
      persistenceXmlUrl - The persistence.xml URL
      name - The PU name to match
      Returns:
      The matching persistence-unit descriptor
    • locateNamedPersistenceUnit

      public static ParsedPersistenceXmlDescriptor locateNamedPersistenceUnit(URL persistenceXmlUrl, String name, Map integration)
      Parse a specific persistence.xml and return the descriptor for the persistence-unit with matching name
      Parameters:
      persistenceXmlUrl - The persistence.xml URL
      name - The PU name to match
      integration - The Map of integration settings
      Returns:
      The matching persistence-unit descriptor
    • locateNamedPersistenceUnit

      public static ParsedPersistenceXmlDescriptor locateNamedPersistenceUnit(URL persistenceXmlUrl, String name, PersistenceUnitTransactionType transactionType, Map integration)
      Parse a specific persistence.xml and return the descriptor for the persistence-unit with matching name
      Parameters:
      persistenceXmlUrl - The persistence.xml URL
      name - The PU name to match
      transactionType - The specific PersistenceUnitTransactionType to incorporate into the persistence-unit descriptor
      integration - The Map of integration settings
      Returns:
      The matching persistence-unit descriptor
    • parse

      public static Map<String,ParsedPersistenceXmlDescriptor> parse(URL persistenceXmlUrl, PersistenceUnitTransactionType transactionType)
      Intended only for use by Hibernate tests!

      Parses a specific persistence.xml file...

    • parse

      public static Map<String,ParsedPersistenceXmlDescriptor> parse(URL persistenceXmlUrl, PersistenceUnitTransactionType transactionType, Map integration)
      Generic method to parse a specified persistence.xml and return a Map of descriptors for all discovered persistence-units keyed by the PU name.
      Parameters:
      persistenceXmlUrl - The URL of the persistence.xml to parse
      transactionType - The specific PersistenceUnitTransactionType to incorporate into the persistence-unit descriptor
      integration - The Map of integration settings
      Returns:
      Map of persistence-unit descriptors keyed by the PU name
    • getResolvedPersistenceUnits

      protected List<ParsedPersistenceXmlDescriptor> getResolvedPersistenceUnits()
    • parsePersistenceXml

      protected void parsePersistenceXml(URL xmlUrl, Map integration)