Package org.datanucleus.api.jakarta
Class PersistenceProviderImpl
- java.lang.Object
-
- org.datanucleus.api.jakarta.PersistenceProviderImpl
-
- All Implemented Interfaces:
jakarta.persistence.spi.PersistenceProvider
,jakarta.persistence.spi.ProviderUtil
public class PersistenceProviderImpl extends Object implements jakarta.persistence.spi.PersistenceProvider, jakarta.persistence.spi.ProviderUtil
PersistenceProvider implementation. Provides a means of creating EntityManagerFactory objects.
-
-
Constructor Summary
Constructors Constructor Description PersistenceProviderImpl()
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description jakarta.persistence.EntityManagerFactory
createContainerEntityManagerFactory(jakarta.persistence.spi.PersistenceUnitInfo unitInfo, Map properties)
Method to create an EntityManagerFactory when running in JavaEE.jakarta.persistence.EntityManagerFactory
createEntityManagerFactory(String unitName, Map properties)
Method to create an EntityManagerFactory when running in JavaSE.void
generateSchema(jakarta.persistence.spi.PersistenceUnitInfo unitInfo, Map overridingProps)
Create database schemas and/or tables and/or create DDL scripts as determined by the supplied properties.boolean
generateSchema(String unitName, Map overridingProps)
Create database schemas and/or tables and/or create DDL scripts as determined by the supplied properties.protected void
generateSchemaForPersistentUnit(org.datanucleus.metadata.PersistenceUnitMetaData pumd, Map overridingProps)
jakarta.persistence.spi.ProviderUtil
getProviderUtil()
jakarta.persistence.spi.LoadState
isLoaded(Object entity)
If the provider determines that the entity has been provided by itself and that the state of all attributes for which FetchType EAGER has been specified have been loaded, this method returns LoadState.LOADED.jakarta.persistence.spi.LoadState
isLoadedWithoutReference(Object entity, String memberName)
If the provider determines that the entity has been provided by itself and that the state of the specified attribute has been loaded, this method returns LoadState.LOADED.jakarta.persistence.spi.LoadState
isLoadedWithReference(Object entity, String memberName)
If the provider determines that the entity has been provided by itself and that the state of the specified attribute has been loaded, this method returns LoadState.LOADED.
-
-
-
Method Detail
-
createContainerEntityManagerFactory
public jakarta.persistence.EntityManagerFactory createContainerEntityManagerFactory(jakarta.persistence.spi.PersistenceUnitInfo unitInfo, Map properties)
Method to create an EntityManagerFactory when running in JavaEE. The container will have parsed the persistence.xml files to provide this PersistenceUnitInfo.- Specified by:
createContainerEntityManagerFactory
in interfacejakarta.persistence.spi.PersistenceProvider
- Parameters:
unitInfo
- The "persistence-unit"properties
- EntityManagerFactory properties to override those in the persistence unit- Returns:
- The EntityManagerFactory
-
createEntityManagerFactory
public jakarta.persistence.EntityManagerFactory createEntityManagerFactory(String unitName, Map properties)
Method to create an EntityManagerFactory when running in JavaSE.- Specified by:
createEntityManagerFactory
in interfacejakarta.persistence.spi.PersistenceProvider
- Parameters:
unitName
- Name of the "persistence-unit"properties
- EntityManagerFactory properties to override those in the persistence unit- Returns:
- The EntityManagerFactory
-
isLoadedWithoutReference
public jakarta.persistence.spi.LoadState isLoadedWithoutReference(Object entity, String memberName)
If the provider determines that the entity has been provided by itself and that the state of the specified attribute has been loaded, this method returns LoadState.LOADED. If the provider determines that the entity has been provided by itself and that either entity attributes with FetchType EAGER have not been loaded or that the state of the specified attribute has not been loaded, this methods returns LoadState.NOT_LOADED. If a provider cannot determine the load state, this method returns LoadState.UNKNOWN. The provider's implementation of this method must not obtain a reference to an attribute value, as this could trigger the loading of entity state if the entity has been provided by a different provider.- Specified by:
isLoadedWithoutReference
in interfacejakarta.persistence.spi.ProviderUtil
- Parameters:
entity
- The entitymemberName
- Name of member whose load status is to be determined- Returns:
- load status of the attribute
-
isLoadedWithReference
public jakarta.persistence.spi.LoadState isLoadedWithReference(Object entity, String memberName)
If the provider determines that the entity has been provided by itself and that the state of the specified attribute has been loaded, this method returns LoadState.LOADED. If a provider determines that the entity has been provided by itself and that either the entity attributes with FetchType EAGER have not been loaded or that the state of the specified attribute has not been loaded, this method returns return LoadState.NOT_LOADED. If the provider cannot determine the load state, this method returns LoadState.UNKNOWN. The provider's implementation of this method is permitted to obtain a reference to the attribute value. (This access is safe because providers which might trigger the loading of the attribute state will have already been determined by isLoadedWithoutReference.)- Specified by:
isLoadedWithReference
in interfacejakarta.persistence.spi.ProviderUtil
- Parameters:
entity
- The entitymemberName
- name of member whose load status is to be determined- Returns:
- load status of the member
-
isLoaded
public jakarta.persistence.spi.LoadState isLoaded(Object entity)
If the provider determines that the entity has been provided by itself and that the state of all attributes for which FetchType EAGER has been specified have been loaded, this method returns LoadState.LOADED. If the provider determines that the entity has been provided by itself and that not all attributes with FetchType EAGER have been loaded, this method returns LoadState.NOT_LOADED. If the provider cannot determine if the entity has been provided by itself, this method returns LoadState.UNKNOWN. The provider's implementation of this method must not obtain a reference to any attribute value, as this could trigger the loading of entity state if the entity has been provided by a different provider.- Specified by:
isLoaded
in interfacejakarta.persistence.spi.ProviderUtil
- Parameters:
entity
- whose loaded status is to be determined- Returns:
- load status of the entity
-
getProviderUtil
public jakarta.persistence.spi.ProviderUtil getProviderUtil()
- Specified by:
getProviderUtil
in interfacejakarta.persistence.spi.PersistenceProvider
-
generateSchema
public void generateSchema(jakarta.persistence.spi.PersistenceUnitInfo unitInfo, Map overridingProps)
Create database schemas and/or tables and/or create DDL scripts as determined by the supplied properties. Called by the container when schema generation is to occur as a separate phase from creation of the entity manager factory.- Specified by:
generateSchema
in interfacejakarta.persistence.spi.PersistenceProvider
- Parameters:
unitInfo
- metadata for use by the persistence provideroverridingProps
- properties for schema generation; these may also include provider-specific properties- Throws:
jakarta.persistence.PersistenceException
- if insufficient or inconsistent configuration information is provided or if schema generation otherwise fails.
-
generateSchema
public boolean generateSchema(String unitName, Map overridingProps)
Create database schemas and/or tables and/or create DDL scripts as determined by the supplied properties. Called by the container when schema generation is to occur as a separate phase from creation of the entity manager factory.- Specified by:
generateSchema
in interfacejakarta.persistence.spi.PersistenceProvider
- Parameters:
unitName
- Name of the persistence unitoverridingProps
- properties for schema generation; these may also include provider-specific properties- Throws:
jakarta.persistence.PersistenceException
- if insufficient or inconsistent configuration information is provided or if schema generation otherwise fails.
-
generateSchemaForPersistentUnit
protected void generateSchemaForPersistentUnit(org.datanucleus.metadata.PersistenceUnitMetaData pumd, Map overridingProps)
-
-