Package org.apache.openjpa.persistence
Class PersistenceUnitInfoImpl
java.lang.Object
org.apache.openjpa.persistence.PersistenceUnitInfoImpl
- All Implemented Interfaces:
jakarta.persistence.spi.PersistenceUnitInfo
,SourceTracker
public class PersistenceUnitInfoImpl
extends Object
implements jakarta.persistence.spi.PersistenceUnitInfo, SourceTracker
Implementation of the
PersistenceUnitInfo
interface used by OpenJPA
when parsing persistence configuration information.-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
Simple class resolver built around the persistence unit loader. -
Field Summary
Fields inherited from interface org.apache.openjpa.lib.meta.SourceTracker
SRC_ANNOTATIONS, SRC_OTHER, SRC_XML
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addJarFile
(URL jar) void
addJarFileName
(String name) void
addManagedClassName
(String name) void
addMappingFileName
(String name) void
addTransformer
(jakarta.persistence.spi.ClassTransformer transformer) boolean
void
fromUserProperties
(Map map) Load the given user-supplied map of properties into this persistence unit.int
Return the column number in the line of the file at which this instance was parsed.int
Return the line number of the file at which this instance was parsed.The location of the persistence.xml resource.Return the domain-meaningful name of the resource that was loaded from this source.jakarta.persistence.SharedCacheMode
Return the file from which this instance was parsed.Return the domain-dependent scope of this instance within its file.int
Return the type of source.jakarta.persistence.spi.PersistenceUnitTransactionType
jakarta.persistence.ValidationMode
void
Process jar-file elements.void
setExcludeUnlistedClasses
(boolean excludeUnlisted) void
void
void
void
setNonJtaDataSourceName
(String nonJta) void
setPersistenceProviderClassName
(String providerClassName) void
setPersistenceUnitName
(String emName) void
setPersistenceUnitRootUrl
(URL root) void
The location of the persistence.xml resource.void
setPersistenceXMLSchemaVersion
(String version) void
setProperty
(String key, String value) void
setSharedCacheMode
(jakarta.persistence.SharedCacheMode mode) void
setTransactionType
(jakarta.persistence.spi.PersistenceUnitTransactionType transType) void
setValidationMode
(jakarta.persistence.ValidationMode mode) Return aMap
containing the properties necessary to create aConfiguration
that reflects the information in this persistence unit info.static Map
toOpenJPAProperties
(jakarta.persistence.spi.PersistenceUnitInfo info) Return aMap
containing the properties necessary to create aConfiguration
that reflects the information in the given persistence unit info.void
validateJarFileName
(String name)
-
Field Details
-
PERSISTENCE_VERSION
- See Also:
-
-
Constructor Details
-
PersistenceUnitInfoImpl
public PersistenceUnitInfoImpl()
-
-
Method Details
-
getClassLoader
- Specified by:
getClassLoader
in interfacejakarta.persistence.spi.PersistenceUnitInfo
-
getNewTempClassLoader
- Specified by:
getNewTempClassLoader
in interfacejakarta.persistence.spi.PersistenceUnitInfo
-
getPersistenceUnitName
- Specified by:
getPersistenceUnitName
in interfacejakarta.persistence.spi.PersistenceUnitInfo
-
setPersistenceUnitName
-
getPersistenceProviderClassName
- Specified by:
getPersistenceProviderClassName
in interfacejakarta.persistence.spi.PersistenceUnitInfo
-
setPersistenceProviderClassName
-
getTransactionType
public jakarta.persistence.spi.PersistenceUnitTransactionType getTransactionType()- Specified by:
getTransactionType
in interfacejakarta.persistence.spi.PersistenceUnitInfo
-
setTransactionType
public void setTransactionType(jakarta.persistence.spi.PersistenceUnitTransactionType transType) -
getJtaDataSourceName
-
setJtaDataSourceName
-
getJtaDataSource
- Specified by:
getJtaDataSource
in interfacejakarta.persistence.spi.PersistenceUnitInfo
-
setJtaDataSource
-
getNonJtaDataSourceName
-
setNonJtaDataSourceName
-
getNonJtaDataSource
- Specified by:
getNonJtaDataSource
in interfacejakarta.persistence.spi.PersistenceUnitInfo
-
setNonJtaDataSource
-
getPersistenceUnitRootUrl
- Specified by:
getPersistenceUnitRootUrl
in interfacejakarta.persistence.spi.PersistenceUnitInfo
-
setPersistenceUnitRootUrl
-
excludeUnlistedClasses
public boolean excludeUnlistedClasses()- Specified by:
excludeUnlistedClasses
in interfacejakarta.persistence.spi.PersistenceUnitInfo
-
setExcludeUnlistedClasses
public void setExcludeUnlistedClasses(boolean excludeUnlisted) -
getMappingFileNames
- Specified by:
getMappingFileNames
in interfacejakarta.persistence.spi.PersistenceUnitInfo
-
addMappingFileName
-
getJarFileUrls
- Specified by:
getJarFileUrls
in interfacejakarta.persistence.spi.PersistenceUnitInfo
-
addJarFile
-
addJarFileName
-
processJarFileNames
public void processJarFileNames()Process jar-file elements. An IllegalArgumentException may be thrown if the jar file does not exist in the classpath. -
validateJarFileName
-
getManagedClassNames
- Specified by:
getManagedClassNames
in interfacejakarta.persistence.spi.PersistenceUnitInfo
-
addManagedClassName
-
getProperties
- Specified by:
getProperties
in interfacejakarta.persistence.spi.PersistenceUnitInfo
-
setProperty
-
addTransformer
public void addTransformer(jakarta.persistence.spi.ClassTransformer transformer) - Specified by:
addTransformer
in interfacejakarta.persistence.spi.PersistenceUnitInfo
-
getPersistenceXmlFileUrl
The location of the persistence.xml resource. May be null. -
setPersistenceXmlFileUrl
The location of the persistence.xml resource. May be null. -
fromUserProperties
Load the given user-supplied map of properties into this persistence unit. -
toOpenJPAProperties
Return aMap
containing the properties necessary to create aConfiguration
that reflects the information in this persistence unit info. -
toOpenJPAProperties
Return aMap
containing the properties necessary to create aConfiguration
that reflects the information in the given persistence unit info. -
getSourceFile
Description copied from interface:SourceTracker
Return the file from which this instance was parsed.- Specified by:
getSourceFile
in interfaceSourceTracker
-
getSourceScope
Description copied from interface:SourceTracker
Return the domain-dependent scope of this instance within its file.- Specified by:
getSourceScope
in interfaceSourceTracker
-
getSourceType
public int getSourceType()Description copied from interface:SourceTracker
Return the type of source.- Specified by:
getSourceType
in interfaceSourceTracker
-
getLineNumber
public int getLineNumber()Description copied from interface:SourceTracker
Return the line number of the file at which this instance was parsed.- Specified by:
getLineNumber
in interfaceSourceTracker
-
getColNumber
public int getColNumber()Description copied from interface:SourceTracker
Return the column number in the line of the file at which this instance was parsed.- Specified by:
getColNumber
in interfaceSourceTracker
-
getResourceName
Description copied from interface:SourceTracker
Return the domain-meaningful name of the resource that was loaded from this source. I.e., if we had loaded the source for a Java class, this would return the name of the class.- Specified by:
getResourceName
in interfaceSourceTracker
-
getPersistenceXMLSchemaVersion
- Specified by:
getPersistenceXMLSchemaVersion
in interfacejakarta.persistence.spi.PersistenceUnitInfo
-
setPersistenceXMLSchemaVersion
-
getValidationMode
public jakarta.persistence.ValidationMode getValidationMode()- Specified by:
getValidationMode
in interfacejakarta.persistence.spi.PersistenceUnitInfo
-
setValidationMode
public void setValidationMode(jakarta.persistence.ValidationMode mode)
-