Package org.datanucleus.api.jpa
Class PersistenceProviderImpl
- java.lang.Object
-
- org.datanucleus.api.jpa.PersistenceProviderImpl
-
- All Implemented Interfaces:
javax.persistence.spi.PersistenceProvider,javax.persistence.spi.ProviderUtil
public class PersistenceProviderImpl extends Object implements javax.persistence.spi.PersistenceProvider, javax.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 javax.persistence.EntityManagerFactorycreateContainerEntityManagerFactory(javax.persistence.spi.PersistenceUnitInfo unitInfo, Map properties)Method to create an EntityManagerFactory when running in JavaEE.javax.persistence.EntityManagerFactorycreateEntityManagerFactory(String unitName, Map properties)Method to create an EntityManagerFactory when running in JavaSE.booleangenerateSchema(String unitName, Map overridingProps)Create database schemas and/or tables and/or create DDL scripts as determined by the supplied properties.voidgenerateSchema(javax.persistence.spi.PersistenceUnitInfo unitInfo, Map overridingProps)Create database schemas and/or tables and/or create DDL scripts as determined by the supplied properties.protected voidgenerateSchemaForPersistentUnit(org.datanucleus.metadata.PersistenceUnitMetaData pumd, Map overridingProps)javax.persistence.spi.ProviderUtilgetProviderUtil()javax.persistence.spi.LoadStateisLoaded(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.javax.persistence.spi.LoadStateisLoadedWithoutReference(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.javax.persistence.spi.LoadStateisLoadedWithReference(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 javax.persistence.EntityManagerFactory createContainerEntityManagerFactory(javax.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:
createContainerEntityManagerFactoryin interfacejavax.persistence.spi.PersistenceProvider- Parameters:
unitInfo- The "persistence-unit"properties- EntityManagerFactory properties to override those in the persistence unit- Returns:
- The EntityManagerFactory
-
createEntityManagerFactory
public javax.persistence.EntityManagerFactory createEntityManagerFactory(String unitName, Map properties)
Method to create an EntityManagerFactory when running in JavaSE.- Specified by:
createEntityManagerFactoryin interfacejavax.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 javax.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:
isLoadedWithoutReferencein interfacejavax.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 javax.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:
isLoadedWithReferencein interfacejavax.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 javax.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:
isLoadedin interfacejavax.persistence.spi.ProviderUtil- Parameters:
entity- whose loaded status is to be determined- Returns:
- load status of the entity
-
getProviderUtil
public javax.persistence.spi.ProviderUtil getProviderUtil()
- Specified by:
getProviderUtilin interfacejavax.persistence.spi.PersistenceProvider
-
generateSchema
public void generateSchema(javax.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:
generateSchemain interfacejavax.persistence.spi.PersistenceProvider- Parameters:
unitInfo- metadata for use by the persistence provideroverridingProps- properties for schema generation; these may also include provider-specific properties- Throws:
javax.persistence.PersistenceException- if insufficient or inconsistent configuration information is provided or if schema generation otherwise fails.- Since:
- JPA2.1
-
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:
generateSchemain interfacejavax.persistence.spi.PersistenceProvider- Parameters:
unitName- Name of the persistence unitoverridingProps- properties for schema generation; these may also include provider-specific properties- Throws:
javax.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)
-
-