PersistenceConfiguration
java.lang.Object
∟ jakarta.persistence.PersistenceConfiguration
persistence.xml file. This API may not be used to configure a container-managed persistence unit. That is, the configured persistence unit should be considered a Java SE persistence unit, even when this API is used within the Jakarta EE environment.
If injection of the EntityManagerFactory is required, a CDI Producer may be used to make the EntityManagerFactory available as a CDI managed bean. {@snippet :
- See Also:
- createEntityManagerFactory()
- Since:
- JPA 3.2
Public Constructors
- Parameters:
name- the name of the persistence unit, which may be used by the persistence provider for logging and error reporting
- Since:
- JPA 3.2
Public Methods
- Throws:
- PersistenceException - if required configuration is missing or if the factory could not be created
- Since:
- JPA 3.2
- Return:
- the configured JTA datasource, if any, or null
- Since:
- JPA 3.2
- Parameters:
dataSourceJndiName- the JNDI name of a JTA datasource
- Return:
- this configuration
- Since:
- JPA 3.2
- Parameters:
managedClass- the managed class
- Return:
- this configuration
- Since:
- JPA 3.2
- Return:
- all configured managed classes
- Since:
- JPA 3.2
- Parameters:
name- the resource path of the mapping file
- Return:
- this configuration
- Since:
- JPA 3.2
- Return:
- all configured mapping file resource paths
- Since:
- JPA 3.2
- Return:
- the name of the persistence unit.
- Since:
- JPA 3.2
- Return:
- the configured non-JTA datasource, if any, or null
- Since:
- JPA 3.2
- Parameters:
dataSourceJndiName- the JNDI name of a non-JTA datasource
- Return:
- this configuration
- Since:
- JPA 3.2
- Return:
- the configured properties
- Since:
- JPA 3.2
- Parameters:
properties- the properties
- Return:
- this configuration
- Since:
- JPA 3.2
- Parameters:
name- the property namevalue- the property value
- Return:
- this configuration
- Since:
- JPA 3.2
- Return:
- the qualified name of the persistence provider class.
- Since:
- JPA 3.2
- Parameters:
providerClassName- the qualified name of the persistence provider class
- Return:
- this configuration
- Since:
- JPA 3.2
- Return:
- the shared cache mode
- Since:
- JPA 3.2
- Parameters:
sharedCacheMode- the shared cache mode
- Return:
- this configuration
- Since:
- JPA 3.2
- If PersistenceUnitTransactionType.JTA, a JTA data source must be provided via PersistenceConfiguration.jtaDataSource, or by the container.
- If PersistenceUnitTransactionType.RESOURCE_LOCAL, database connection properties may be specified via PersistenceConfiguration.properties, or a non-JTA datasource may be provided via PersistenceConfiguration.nonJtaDataSource.
- Return:
- the transaction type
- Since:
- JPA 3.2
- Parameters:
transactionType- the transaction type
- Return:
- this configuration
- Since:
- JPA 3.2
- Return:
- the validation mode
- Since:
- JPA 3.2
- Parameters:
validationMode- the shared cache mode
- Return:
- this configuration
- Since:
- JPA 3.2
Public Static Fields
Defined for use with createEntityManagerFactory(). Clients of this PersistenceConfiguration class should use sharedCacheMode().
- Since:
- JPA 3.2
- Since:
- JPA 3.2
- Since:
- JPA 3.2
- Since:
- JPA 3.2
- Since:
- JPA 3.2
- Since:
- JPA 3.2
- Since:
- JPA 3.2
- Since:
- JPA 3.2
- Since:
- JPA 3.2
Standard sources are: metadata, script, metadata-then-script, script-then-metadata.
The location of the script source is specified by {@value #SCHEMAGEN_CREATE_SCRIPT_SOURCE}.
- Since:
- JPA 3.2
- Since:
- JPA 3.2
Standard actions are: none, create, drop, drop-and-create, validate.
- Since:
- JPA 3.2
- Since:
- JPA 3.2
Standard sources are: metadata, script, metadata-then-script, script-then-metadata.
The location of the script source is specified by {@value #SCHEMAGEN_DROP_SCRIPT_SOURCE}.
- Since:
- JPA 3.2
- Since:
- JPA 3.2
The script is generated in the location specified by {@value #SCHEMAGEN_CREATE_TARGET} or {@value #SCHEMAGEN_DROP_TARGET}.
Standard actions are: none, create, drop, drop-and-create.
- Since:
- JPA 3.2
- Since:
- JPA 3.2
- Since:
- JPA 3.2
- Since:
- JPA 3.2
- Since:
- JPA 3.2