EntityManagerFactory
in Java SE environments. It may also be used to cause schema
generation to occur.
The Persistence class is available in a Jakarta EE
container environment as well; however, support for the Java SE
bootstrapping APIs is not required in container environments.
The Persistence class is used to obtain a PersistenceUtil instance in both Jakarta EE
and Java SE environments.
| Modifier and Type | Class and Description |
|---|---|
| private static class | Persistence.
Implementation of the |
| Modifier and Type | Field and Description |
|---|---|
| public static final String | PERSISTENCE_PROVIDER
Deprecated
for removal since 3.2. TODO: Either change TCK reference to PERSISTENCE_PROVIDER field to expect
"jakarta.persistence.spi.PersistenceProvider" or remove PERSISTENCE_PROVIDER field and also update TCK signature
tests.
This final String is deprecated and should be removed and is only here for TCK backward compatibility
|
| protected static final Set | providers
Deprecated
for removal since 3.2.
This instance variable is deprecated and should be removed and is only here for TCK backward compatibility
|
| Access | Constructor and Description |
|---|---|
| public | Persistence()
Deprecated
for removal since 3.2. This class is not intended to be extended nor instantiated,
it is going to be marked
final when this constructor becomes hidden.
Default constructor. |
| Modifier and Type | Method and Description |
|---|---|
| public static EntityManagerFactory | Returns: the factory that createsEntityManagers configured
according to the specified persistence unitthe name of the persistence unit persistenceUnitName)Create and return an |
| public static EntityManagerFactory | Returns: the factory that createsEntityManagers configured
according to the specified persistence unitthe name of the persistence unit persistenceUnitName, Map<?, ?> additional properties to use when creating the
factory. These properties may include properties
to control schema generation. The values of these
properties override any values that may have been
configured elsewhere. properties)Create and return an |
| public static EntityManagerFactory | Returns: the factory that createsEntityManagers configured
according to the specified persistence unitconfiguration of the persistence unit configuration)Create and return an |
| public static void | generateSchema(String
the name of the persistence unit persistenceUnitName, Map<?, ?> properties for schema generation; these may also
contain provider-specific properties. The values
of these properties override any values that may
have been configured elsewhere. map)Create database schemas and/or tables and/or create DDL scripts as determined by the supplied properties. |
| public static PersistenceUtil |
| PERSISTENCE_PROVIDER | back to summary |
|---|---|
| public static final String PERSISTENCE_PROVIDER
Deprecated for removal since 3.2. TODO: Either change TCK reference to PERSISTENCE_PROVIDER field to expect "jakarta.persistence.spi.PersistenceProvider" or remove PERSISTENCE_PROVIDER field and also update TCK signature tests. This final String is deprecated and should be removed and is only here for TCK backward compatibility
| |
| providers | back to summary |
|---|---|
| protected static final Set<PersistenceProvider> providers
Deprecated for removal since 3.2.
This instance variable is deprecated and should be removed and is only here for TCK backward compatibility
| |
| Persistence | back to summary |
|---|---|
| public Persistence()
Deprecated for removal since 3.2. This class is not intended to be extended nor instantiated,
it is going to be marked Default constructor.
| |
| createEntityManagerFactory | back to summary |
|---|---|
| public static EntityManagerFactory createEntityManagerFactory(String persistenceUnitName) Create and return an
| |
| createEntityManagerFactory | back to summary |
|---|---|
| public static EntityManagerFactory createEntityManagerFactory(String persistenceUnitName, Map<?, ?> properties) Create and return an
| |
| createEntityManagerFactory | back to summary |
|---|---|
| public static EntityManagerFactory createEntityManagerFactory(PersistenceConfiguration configuration) Create and return an
| |
| generateSchema | back to summary |
|---|---|
| public static void generateSchema(String persistenceUnitName, Map<?, ?> map) Create database schemas and/or tables and/or create DDL scripts as determined by the supplied properties. Called when schema generation is to occur as a separate phase from creation of the entity manager factory.
| |
| getPersistenceUtil | back to summary |
|---|---|
| public static PersistenceUtil getPersistenceUtil() Return the
| |
PersistenceUtil interface
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public boolean | isLoaded(Object
entity containing the attribute entity, String name of attribute whose load state is
to be determined attributeName)Implements jakarta. Determine the load state of a given persistent attribute. |
| public boolean | isLoaded(Object
whose load state is to be determined entity)Implements jakarta. Determine the load state of an entity. |
| PersistenceUtilImpl | back to summary |
|---|---|
| private PersistenceUtilImpl() | |
| isLoaded | back to summary |
|---|---|
| public boolean isLoaded(Object entity, String attributeName) Implements jakarta. Doc from jakarta. Determine the load state of a given persistent attribute. | |
| isLoaded | back to summary |
|---|---|
| public boolean isLoaded(Object entity) Implements jakarta. Doc from jakarta. Determine the load state of an entity.
This method can be used to determine the load state of an
entity passed as a reference. An entity is considered loaded
if all attributes for which The
| |