Top Description Methods
jakarta.persistence.spi

public Interface PersistenceUnitInfo

Imports
javax.sql.DataSource, java.util.List, .Properties, java.net.URL, jakarta.persistence.SharedCacheMode, .ValidationMode, .EntityManagerFactory

Interface implemented by the container and used by the persistence provider when creating an EntityManagerFactory.
Since
1.0

Method Summary

Modifier and TypeMethod and Description
public void
addTransformer(ClassTransformer
provider-supplied transformer that the container invokes at class-(re)definition time
transformer
)

Add a transformer supplied by the provider that is called for every new class definition or class redefinition that gets loaded by the loader returned by the PersistenceUnitInfo#getClassLoader method.

public boolean

Returns:

whether classes in the root of the persistence unit that have not been explicitly listed are to be included in the set of managed classes
excludeUnlistedClasses
()

Returns whether classes in the root of the persistence unit that have not been explicitly listed are to be included in the set of managed classes.

public ClassLoader

Returns:

ClassLoader that the provider may use to load any classes, resources, or open URLs
getClassLoader
()

Returns ClassLoader that the provider may use to load any classes, resources, or open URLs.

public List<URL>

Returns:

a list of URL objects referring to jar files or directories
getJarFileUrls
()

Returns a list of URLs for the jar files or exploded jar file directories that the persistence provider must examine for managed classes of the persistence unit.

public DataSource

Returns:

the JTA-enabled data source to be used by the persistence provider
getJtaDataSource
()

Returns the JTA-enabled data source to be used by the persistence provider.

public List<String>

Returns:

the list of the names of the classes that the persistence provider must add to its set of managed classes
getManagedClassNames
()

Returns the list of the names of the classes that the persistence provider must add to its set of managed classes.

public List<String>

Returns:

the list of mapping file names that the persistence provider must load to determine the mappings for the entity classes
getMappingFileNames
()

Returns the list of the names of the mapping files that the persistence provider must load to determine the mappings for the entity classes.

public ClassLoader

Returns:

temporary ClassLoader with same visibility as current loader
getNewTempClassLoader
()

Return a new instance of a ClassLoader that the provider may use to temporarily load any classes, resources, or open URLs.

public DataSource

Returns:

the non-JTA-enabled data source to be used by the persistence provider for accessing data outside a JTA transaction
getNonJtaDataSource
()

Returns the non-JTA-enabled data source to be used by the persistence provider for accessing data outside a JTA transaction.

public String

Returns:

the fully qualified name of the persistence provider implementation class
getPersistenceProviderClassName
()

Returns the fully qualified name of the persistence provider implementation class.

public String

Returns:

the name of the persistence unit
getPersistenceUnitName
()

Returns the name of the persistence unit.

public URL

Returns:

a URL referring to a jar file or directory
getPersistenceUnitRootUrl
()

Returns the URL for the jar file or directory that is the root of the persistence unit.

public String

Returns:

persistence.xml schema version
getPersistenceXMLSchemaVersion
()

Returns the schema version of the persistence.xml file.

public Properties

Returns:

Properties object
getProperties
()

Returns a properties object.

public List<String>

Returns:

the fully-qualified class names of the qualifier annotations, or an empty list if no qualifier annotations were explicitly specified
getQualifierAnnotationNames
()

Returns the fully-qualified class names of annotations annotated Qualifier.

public String

Returns:

the fully-qualified class name of the scope annotation, or null if no scope was explicitly specified
getScopeAnnotationName
()

Returns the fully-qualified class name of an annotation annotated Scope or NormalScope.

public SharedCacheMode

Returns:

the second-level cache mode that must be used by the provider for the persistence unit
getSharedCacheMode
()

Returns the specification of how the provider must use a second-level cache for the persistence unit.

public PersistenceUnitTransactionType

Returns:

transaction type of the entity managers created by the EntityManagerFactory

Note

This method will change its return type to jakarta.persistence.PersistenceUnitTransactionType in the next major version.

getTransactionType
()
References Deprecated PersistenceUnitTransactionType is deprecated or references (maybe indirectly) at least one deprecated element.

Returns the transaction type of the entity managers created by the EntityManagerFactory.

public ValidationMode

Returns:

the validation mode to be used by the persistence provider for the persistence unit
getValidationMode
()

Returns the validation mode to be used by the persistence provider for the persistence unit.

Method Detail

addTransformerback to summary
public void addTransformer(ClassTransformer transformer)

Add a transformer supplied by the provider that is called for every new class definition or class redefinition that gets loaded by the loader returned by the PersistenceUnitInfo#getClassLoader method. The transformer has no effect on the result returned by the PersistenceUnitInfo#getNewTempClassLoader method. Classes are only transformed once within the same classloading scope, regardless of how many persistence units they may be a part of.

Parameters
transformer:ClassTransformer

provider-supplied transformer that the container invokes at class-(re)definition time

excludeUnlistedClassesback to summary
public boolean excludeUnlistedClasses()

Returns whether classes in the root of the persistence unit that have not been explicitly listed are to be included in the set of managed classes. This value corresponds to the exclude-unlisted-classes element in the persistence.xml file.

Returns:boolean

whether classes in the root of the persistence unit that have not been explicitly listed are to be included in the set of managed classes

getClassLoaderback to summary
public ClassLoader getClassLoader()

Returns ClassLoader that the provider may use to load any classes, resources, or open URLs.

Returns:ClassLoader

ClassLoader that the provider may use to load any classes, resources, or open URLs

getJarFileUrlsback to summary
public List<URL> getJarFileUrls()

Returns a list of URLs for the jar files or exploded jar file directories that the persistence provider must examine for managed classes of the persistence unit. Each URL corresponds to a jar-file element in the persistence.xml file. A URL will either be a file: URL referring to a jar file or referring to a directory that contains an exploded jar file, or some other URL from which an InputStream in jar format can be obtained.

Returns:List<URL>

a list of URL objects referring to jar files or directories

getJtaDataSourceback to summary
public DataSource getJtaDataSource()

Returns the JTA-enabled data source to be used by the persistence provider. The data source corresponds to the jta-data-source element in the persistence.xml file or is provided at deployment or by the container.

Returns:DataSource

the JTA-enabled data source to be used by the persistence provider

getManagedClassNamesback to summary
public List<String> getManagedClassNames()

Returns the list of the names of the classes that the persistence provider must add to its set of managed classes. Each name corresponds to a named class element in the persistence.xml file.

Returns:List<String>

the list of the names of the classes that the persistence provider must add to its set of managed classes

getMappingFileNamesback to summary
public List<String> getMappingFileNames()

Returns the list of the names of the mapping files that the persistence provider must load to determine the mappings for the entity classes. The mapping files must be in the standard XML mapping format, be uniquely named and be resource-loadable from the application classpath. Each mapping file name corresponds to a mapping-file element in the persistence.xml file.

Returns:List<String>

the list of mapping file names that the persistence provider must load to determine the mappings for the entity classes

getNewTempClassLoaderback to summary
public ClassLoader getNewTempClassLoader()

Return a new instance of a ClassLoader that the provider may use to temporarily load any classes, resources, or open URLs. The scope and classpath of this loader is exactly the same as that of the loader returned by PersistenceUnitInfo#getClassLoader. None of the classes loaded by this class loader are visible to application components. The provider may only use this ClassLoader within the scope of the PersistenceProvider#createContainerEntityManagerFactory call.

Returns:ClassLoader

temporary ClassLoader with same visibility as current loader

getNonJtaDataSourceback to summary
public DataSource getNonJtaDataSource()

Returns the non-JTA-enabled data source to be used by the persistence provider for accessing data outside a JTA transaction. The data source corresponds to the named non-jta-data-source element in the persistence.xml file or provided at deployment or by the container.

Returns:DataSource

the non-JTA-enabled data source to be used by the persistence provider for accessing data outside a JTA transaction

getPersistenceProviderClassNameback to summary
public String getPersistenceProviderClassName()

Returns the fully qualified name of the persistence provider implementation class. Corresponds to the provider element in the persistence.xml file.

Returns:String

the fully qualified name of the persistence provider implementation class

getPersistenceUnitNameback to summary
public String getPersistenceUnitName()

Returns the name of the persistence unit. Corresponds to the name attribute in the persistence.xml file.

Returns:String

the name of the persistence unit

getPersistenceUnitRootUrlback to summary
public URL getPersistenceUnitRootUrl()

Returns the URL for the jar file or directory that is the root of the persistence unit. (If the persistence unit is rooted in the WEB-INF/classes directory, this is the URL of that directory.) The URL will either be a file: URL referring to a jar file or referring to a directory that contains an exploded jar file, or some other URL from which an InputStream in jar format can be obtained.

Returns:URL

a URL referring to a jar file or directory

getPersistenceXMLSchemaVersionback to summary
public String getPersistenceXMLSchemaVersion()

Returns the schema version of the persistence.xml file.

Returns:String

persistence.xml schema version

Since
2.0
getPropertiesback to summary
public Properties getProperties()

Returns a properties object. Each property corresponds to a property element in the persistence.xml file or to a property set by the container.

Returns:Properties

Properties object

getQualifierAnnotationNamesback to summary
public List<String> getQualifierAnnotationNames()

Returns the fully-qualified class names of annotations annotated Qualifier. Corresponds to the qualifier element in persistence.xml.

Returns:List<String>

the fully-qualified class names of the qualifier annotations, or an empty list if no qualifier annotations were explicitly specified

getScopeAnnotationNameback to summary
public String getScopeAnnotationName()

Returns the fully-qualified class name of an annotation annotated Scope or NormalScope. Corresponds to the scope element in persistence.xml.

Returns:String

the fully-qualified class name of the scope annotation, or null if no scope was explicitly specified

getSharedCacheModeback to summary
public SharedCacheMode getSharedCacheMode()

Returns the specification of how the provider must use a second-level cache for the persistence unit. The result of this method corresponds to the shared-cache-mode element in the persistence.xml file.

Returns:SharedCacheMode

the second-level cache mode that must be used by the provider for the persistence unit

Since
2.0
getTransactionTypeback to summary
public PersistenceUnitTransactionType getTransactionType()

References Deprecated

PersistenceUnitTransactionType is deprecated or references (maybe indirectly) at least one deprecated element.

See corresponding docs for further information.

Returns the transaction type of the entity managers created by the EntityManagerFactory. The transaction type corresponds to the transaction-type attribute in the persistence.xml file.

Returns:PersistenceUnitTransactionType

transaction type of the entity managers created by the EntityManagerFactory

Note

This method will change its return type to jakarta.persistence.PersistenceUnitTransactionType in the next major version.

getValidationModeback to summary
public ValidationMode getValidationMode()

Returns the validation mode to be used by the persistence provider for the persistence unit. The validation mode corresponds to the validation-mode element in the persistence.xml file.

Returns:ValidationMode

the validation mode to be used by the persistence provider for the persistence unit

Since
2.0