org.datanucleus.jpa
Class PersistenceProviderImpl

java.lang.Object
  extended by org.datanucleus.jpa.PersistenceProviderImpl
All Implemented Interfaces:
javax.persistence.spi.PersistenceProvider, javax.persistence.spi.ProviderUtil

public class PersistenceProviderImpl
extends java.lang.Object
implements javax.persistence.spi.PersistenceProvider, javax.persistence.spi.ProviderUtil

PersistenceProvider implementation. Provides a means of creating EntityManagerFactory objects.


Constructor Summary
PersistenceProviderImpl()
          Constructor.
 
Method Summary
 javax.persistence.EntityManagerFactory createContainerEntityManagerFactory(javax.persistence.spi.PersistenceUnitInfo unitInfo, java.util.Map properties)
          Method to create an EntityManagerFactory when running in J2EE.
 javax.persistence.EntityManagerFactory createEntityManagerFactory(java.lang.String unitName, java.util.Map properties)
          Method to create an EntityManagerFactory when running in J2SE.
 javax.persistence.spi.ProviderUtil getProviderUtil()
           
 javax.persistence.spi.LoadState isLoaded(java.lang.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(java.lang.Object entity, java.lang.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(java.lang.Object entity, java.lang.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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PersistenceProviderImpl

public PersistenceProviderImpl()
Constructor.

Method Detail

createContainerEntityManagerFactory

public javax.persistence.EntityManagerFactory createContainerEntityManagerFactory(javax.persistence.spi.PersistenceUnitInfo unitInfo,
                                                                                  java.util.Map properties)
Method to create an EntityManagerFactory when running in J2EE. 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(java.lang.String unitName,
                                                                         java.util.Map properties)
Method to create an EntityManagerFactory when running in J2SE.

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(java.lang.Object entity,
                                                                java.lang.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(java.lang.Object entity,
                                                             java.lang.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(java.lang.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


Copyright © 2011. All Rights Reserved.