Top Description Constructors Methods
org.eclipse.persistence.jpa

public Class PersistenceProvider

extends Object
implements PersistenceProvider, ProviderUtil
Class Inheritance
All Implemented Interfaces
jakarta.persistence.spi.ProviderUtil, jakarta.persistence.spi.PersistenceProvider
Imports
java.util.HashMap, .Iterator, .Map, jakarta.persistence.EntityManagerFactory, .PersistenceException, jakarta.persistence.spi.ClassTransformer, .LoadState, .PersistenceUnitInfo, .ProviderUtil, org.eclipse.persistence.config.PersistenceUnitProperties, .SystemProperties, org.eclipse.persistence.exceptions.PersistenceUnitLoadingException, org.eclipse.persistence.internal.jpa.EntityManagerFactoryImpl, .EntityManagerFactoryProvider, .EntityManagerSetupImpl, org.eclipse.persistence.internal.jpa.deployment.JPAInitializer, .JavaSECMPInitializer, .PersistenceUnitProcessor, .SEPersistenceUnitInfo, org.eclipse.persistence.internal.weaving.PersistenceWeaved

This is the EclipseLink EJB 3.0 provider This provider should be used by JavaEE and JavaSE users.

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public boolean
checkForProviderProperty(Map<K, V> properties)

Need to check that the provider property is null or set for EclipseLink

public EntityManagerFactory

Returns:

EntityManagerFactory for the persistence unit specified by the metadata
createContainerEntityManagerFactory
(PersistenceUnitInfo
Metadata for use by the persistence provider
info
,
Map<K, V>
A Map of integration-level properties for use by the persistence provider.
properties
)

Implements jakarta.persistence.spi.PersistenceProvider.createContainerEntityManagerFactory.

Called by the container when an EntityManagerFactory is to be created.
protected EntityManagerFactory
createContainerEntityManagerFactoryImpl(PersistenceUnitInfo info, Map<K, V> properties, boolean requiresConnection)

public EntityManagerFactory

Returns:

EntityManagerFactory for the persistence unit, or null if the provider is not the right provider
createEntityManagerFactory
(String
The name of the persistence unit
emName
,
Map<K, V>
A Map of properties for use by the persistence provider. These properties may be used to override the values of the corresponding elements in the persistence.xml file or specify values for properties not specified in the persistence.xml.
properties
)

Implements jakarta.persistence.spi.PersistenceProvider.createEntityManagerFactory.

Called by Persistence class when an EntityManagerFactory is to be created.
protected EntityManagerFactoryImpl
createEntityManagerFactoryImpl(PersistenceUnitInfo puInfo, Map<K, V> properties, boolean requiresConnection)

Internal method to return the entity manager factory.

public void
generateSchema(PersistenceUnitInfo
the name of the persistence unit
info
,
Map<K, V>
properties for schema generation; these may also contain provider-specific properties. The value of these properties override any values that may have been configured elsewhere.
properties
)

Implements jakarta.persistence.spi.PersistenceProvider.generateSchema.

Create database schemas and/or tables and/or create DDL scripts as determined by the supplied properties.
public boolean
generateSchema(String
the name of the persistence unit
persistenceUnitName
,
Map<K, V>
properties for schema generation; these may also contain provider-specific properties. The value of these properties override any values that may have been configured elsewhere.
properties
)

Implements jakarta.persistence.spi.PersistenceProvider.generateSchema.

Create database schemas and/or tables and/or create DDL scripts as determined by the supplied properties.
public ClassLoader

Returns:

ClassLoader
getClassLoader
(String emName, Map<K, V> properties)

Answer the classloader to use to create an EntityManager.

public JPAInitializer
getInitializer(String emName, Map<K, V> m)

Return JPAInitializer corresponding to the passed classLoader.

public ProviderUtil

Returns:

ProviderUtil interface
getProviderUtil
()

Implements jakarta.persistence.spi.PersistenceProvider.getProviderUtil.

Return the utility interface implemented by the persistence provider.
public LoadState

Returns:

load status of the entity
isLoaded
(Object
whose loaded status is to be determined
entity
)

Implements jakarta.persistence.spi.ProviderUtil.isLoaded.

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.
public LoadState

Returns:

load status of the attribute
isLoadedWithoutReference
(Object
entity instance
entity
,
String
name of attribute whose load status is to be determined
attributeName
)

Implements jakarta.persistence.spi.ProviderUtil.isLoadedWithoutReference.

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.
public LoadState

Returns:

load status of the attribute
isLoadedWithReference
(Object
entity instance
entity
,
String
name of attribute whose load status is to be determined
attributeName
)

Implements jakarta.persistence.spi.ProviderUtil.isLoadedWithReference.

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.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

PersistenceProviderback to summary
public PersistenceProvider()

Method Detail

checkForProviderPropertyback to summary
public boolean checkForProviderProperty(Map<K, V> properties)

Need to check that the provider property is null or set for EclipseLink

createContainerEntityManagerFactoryback to summary
public EntityManagerFactory createContainerEntityManagerFactory(PersistenceUnitInfo info, Map<K, V> properties)

Implements jakarta.persistence.spi.PersistenceProvider.createContainerEntityManagerFactory.

Called by the container when an EntityManagerFactory is to be created.

Parameters
info:PersistenceUnitInfo

Metadata for use by the persistence provider

properties:Map<K, V>

A Map of integration-level properties for use by the persistence provider.

Returns:EntityManagerFactory

EntityManagerFactory for the persistence unit specified by the metadata

Annotations
@Override
createContainerEntityManagerFactoryImplback to summary
protected EntityManagerFactory createContainerEntityManagerFactoryImpl(PersistenceUnitInfo info, Map<K, V> properties, boolean requiresConnection)
createEntityManagerFactoryback to summary
public EntityManagerFactory createEntityManagerFactory(String emName, Map<K, V> properties)

Implements jakarta.persistence.spi.PersistenceProvider.createEntityManagerFactory.

Called by Persistence class when an EntityManagerFactory is to be created.

Parameters
emName:String

The name of the persistence unit

properties:Map<K, V>

A Map of properties for use by the persistence provider. These properties may be used to override the values of the corresponding elements in the persistence.xml file or specify values for properties not specified in the persistence.xml.

Returns:EntityManagerFactory

EntityManagerFactory for the persistence unit, or null if the provider is not the right provider

Annotations
@Override
createEntityManagerFactoryImplback to summary
protected EntityManagerFactoryImpl createEntityManagerFactoryImpl(PersistenceUnitInfo puInfo, Map<K, V> properties, boolean requiresConnection)

Internal method to return the entity manager factory.

generateSchemaback to summary
public void generateSchema(PersistenceUnitInfo info, Map<K, V> properties)

Implements jakarta.persistence.spi.PersistenceProvider.generateSchema.

Create database schemas and/or tables and/or create DDL scripts as determined by the supplied properties.

Called by the Persistence class when schema generation is to occur as a separate phase from creation of the entity manager factory.

Parameters
info:PersistenceUnitInfo

the name of the persistence unit

properties:Map<K, V>

properties for schema generation; these may also contain provider-specific properties. The value of these properties override any values that may have been configured elsewhere.

Annotations
@Override
Exceptions
PersistenceException:
if insufficient or inconsistent configuration information is provided of if schema generation otherwise fails
Since
Java Persistence 2.1
generateSchemaback to summary
public boolean generateSchema(String persistenceUnitName, Map<K, V> properties)

Implements jakarta.persistence.spi.PersistenceProvider.generateSchema.

Create database schemas and/or tables and/or create DDL scripts as determined by the supplied properties.

Called by the Persistence class when schema generation is to occur as a separate phase from creation of the entity manager factory.

Parameters
persistenceUnitName:String

the name of the persistence unit

properties:Map<K, V>

properties for schema generation; these may also contain provider-specific properties. The value of these properties override any values that may have been configured elsewhere.

Returns:boolean

Doc from jakarta.persistence.spi.PersistenceProvider.generateSchema.

true if schema was generated, otherwise false

Annotations
@Override
Exceptions
PersistenceException:
if insufficient or inconsistent configuration information is provided of if schema generation otherwise fails
Since
Java Persistence 2.1
getClassLoaderback to summary
public ClassLoader getClassLoader(String emName, Map<K, V> properties)

Answer the classloader to use to create an EntityManager. If a classloader is not found in the properties map then use the current thread classloader.

Returns:ClassLoader

ClassLoader

getInitializerback to summary
public JPAInitializer getInitializer(String emName, Map<K, V> m)

Return JPAInitializer corresponding to the passed classLoader.

Note

This is written as an instance method rather than a static to allow it to be overridden

getProviderUtilback to summary
public ProviderUtil getProviderUtil()

Implements jakarta.persistence.spi.PersistenceProvider.getProviderUtil.

Return the utility interface implemented by the persistence provider.

Returns:ProviderUtil

ProviderUtil interface

Annotations
@Override
Since
Java Persistence 2.0
isLoadedback to summary
public LoadState isLoaded(Object entity)

Implements jakarta.persistence.spi.ProviderUtil.isLoaded.

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.

Parameters
entity:Object

whose loaded status is to be determined

Returns:LoadState

load status of the entity

Annotations
@Override
isLoadedWithoutReferenceback to summary
public LoadState isLoadedWithoutReference(Object entity, String attributeName)

Implements jakarta.persistence.spi.ProviderUtil.isLoadedWithoutReference.

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.

Parameters
entity:Object

Doc from jakarta.persistence.spi.ProviderUtil.isLoadedWithoutReference.

entity instance

attributeName:String

name of attribute whose load status is to be determined

Returns:LoadState

load status of the attribute

Annotations
@Override
isLoadedWithReferenceback to summary
public LoadState isLoadedWithReference(Object entity, String attributeName)

Implements jakarta.persistence.spi.ProviderUtil.isLoadedWithReference.

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. )

Parameters
entity:Object

Doc from jakarta.persistence.spi.ProviderUtil.isLoadedWithReference.

entity instance

attributeName:String

name of attribute whose load status is to be determined

Returns:LoadState

load status of the attribute

Annotations
@Override