Class 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.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      javax.persistence.EntityManagerFactory createContainerEntityManagerFactory​(javax.persistence.spi.PersistenceUnitInfo unitInfo, Map properties)
      Method to create an EntityManagerFactory when running in JavaEE.
      javax.persistence.EntityManagerFactory createEntityManagerFactory​(String unitName, Map properties)
      Method to create an EntityManagerFactory when running in JavaSE.
      boolean generateSchema​(String unitName, Map overridingProps)
      Create database schemas and/or tables and/or create DDL scripts as determined by the supplied properties.
      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.
      protected void generateSchemaForPersistentUnit​(org.datanucleus.metadata.PersistenceUnitMetaData pumd, Map overridingProps)  
      javax.persistence.spi.ProviderUtil getProviderUtil()  
      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.
      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.
      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.
    • Constructor Detail

      • PersistenceProviderImpl

        public PersistenceProviderImpl()
        Constructor.
    • 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:
        createContainerEntityManagerFactory in interface javax.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:
        createEntityManagerFactory in interface javax.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:
        isLoadedWithoutReference in interface javax.persistence.spi.ProviderUtil
        Parameters:
        entity - The entity
        memberName - 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:
        isLoadedWithReference in interface javax.persistence.spi.ProviderUtil
        Parameters:
        entity - The entity
        memberName - 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:
        isLoaded in interface javax.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:
        getProviderUtil in interface javax.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:
        generateSchema in interface javax.persistence.spi.PersistenceProvider
        Parameters:
        unitInfo - metadata for use by the persistence provider
        overridingProps - 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:
        generateSchema in interface javax.persistence.spi.PersistenceProvider
        Parameters:
        unitName - Name of the persistence unit
        overridingProps - 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)