Class PersistenceXmlUtil
java.lang.Object
com.orientechnologies.orient.object.jpa.parsing.PersistenceXmlUtil
Simple handler for persistence.xml files.
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic javax.persistence.spi.PersistenceUnitInfofindPersistenceUnit(String unitName, Collection<? extends javax.persistence.spi.PersistenceUnitInfo> units) Parse the persistence.xml files referenced by the URLs in the collectionstatic Collection<? extends javax.persistence.spi.PersistenceUnitInfo>getPersistenceUnits(InputStream is, URL xmlRoot, JPAVersion version) static SchemagetSchema(JPAVersion version) static JPAVersionprotected static <T extends DefaultHandler>
Tparse(InputStream is, T handler) static Collection<? extends javax.persistence.spi.PersistenceUnitInfo>Parse the persistence.xml files referenced by the URLs in the collectionstatic StringparseSchemaVersion(String uri, PersistenceXml element, Attributes attributes)
-
Field Details
-
PERSISTENCE_NS_URI
URI for the JPA persistence namespace- See Also:
-
PERSISTENCE_XML_ROOT
The persistence xml root- See Also:
-
PERSISTENCE_XML_BASE_NAME
- See Also:
-
PERSISTENCE_XSD_DIR
The persistence XSD location- See Also:
-
PERSISTENCE_XML
The persistence XML location- See Also:
-
-
Method Details
-
findPersistenceUnit
public static javax.persistence.spi.PersistenceUnitInfo findPersistenceUnit(String unitName, Collection<? extends javax.persistence.spi.PersistenceUnitInfo> units) Parse the persistence.xml files referenced by the URLs in the collection- Parameters:
persistenceXml-- Returns:
- A collection of parsed persistence units, or null if nothing has been found
-
parse
public static Collection<? extends javax.persistence.spi.PersistenceUnitInfo> parse(URL persistenceXml) Parse the persistence.xml files referenced by the URLs in the collection- Parameters:
persistenceXml-- Returns:
- A collection of parsed persistence units.
- Throws:
IOExceptionSAXExceptionParserConfigurationException
-
getSchema
- Throws:
SAXException
-
getSchemaVersion
public static JPAVersion getSchemaVersion(InputStream is) throws ParserConfigurationException, SAXException, IOException -
getPersistenceUnits
public static Collection<? extends javax.persistence.spi.PersistenceUnitInfo> getPersistenceUnits(InputStream is, URL xmlRoot, JPAVersion version) throws ParserConfigurationException, SAXException, IOException -
parse
protected static <T extends DefaultHandler> T parse(InputStream is, T handler) throws ParserConfigurationException, SAXException, IOException - Parameters:
is- - xml file to be validatedhandler-- Returns:
- handler for chained calls
- Throws:
ParserConfigurationExceptionSAXExceptionIOException
-
parseSchemaVersion
public static String parseSchemaVersion(String uri, PersistenceXml element, Attributes attributes) throws SAXException - Parameters:
uri-element-attributes-- Returns:
- XML Schema Version or null
- Throws:
SAXException
-