Top Description Fields Constructors Methods
org.eclipse.persistence.internal.jpa

public Class EntityManagerFactoryDelegate

extends Object
implements EntityManagerFactory, PersistenceUnitUtil, JpaEntityManagerFactory
Class Inheritance
All Implemented Interfaces
org.eclipse.persistence.jpa.JpaEntityManagerFactory, java.lang.AutoCloseable, jakarta.persistence.EntityManagerFactory, jakarta.persistence.PersistenceUnitUtil, jakarta.persistence.PersistenceUtil
Imports
java.util.Collections, .List, .Locale, .Map, .Set, jakarta.persistence.Cache, .EntityGraph, .EntityManager, .EntityManagerFactory, .FlushModeType, .PersistenceException, .PersistenceUnitUtil, .Query, .SynchronizationType, jakarta.persistence.criteria.CriteriaBuilder, jakarta.persistence.metamodel.Metamodel, org.eclipse.persistence.config.EntityManagerProperties, .FlushClearCache, .PersistenceUnitProperties, .ReferenceMode, org.eclipse.persistence.descriptors.ClassDescriptor, org.eclipse.persistence.internal.jpa.deployment.SEPersistenceUnitInfo, org.eclipse.persistence.internal.jpa.querydef.CriteriaBuilderImpl, org.eclipse.persistence.internal.localization.ExceptionLocalization, org.eclipse.persistence.internal.sessions.AbstractSession, .DatabaseSessionImpl, .PropertiesHandler, org.eclipse.persistence.jpa.JpaEntityManagerFactory, org.eclipse.persistence.queries.AttributeGroup, .DatabaseQuery, .ObjectLevelReadQuery, .ReadQuery, org.eclipse.persistence.sessions.DatabaseSession, .Session, .UnitOfWork.CommitOrderType, org.eclipse.persistence.sessions.broker.SessionBroker, org.eclipse.persistence.sessions.server.Server, .ServerSession

Purpose: Provides the implementation for the EntityManager Factory.

Description: This class will store a reference to the active ServerSession. When a request is made for an EntityManager an new EntityManager is created with the ServerSession and returned. The primary consumer of these EntityManager is assumed to be either the Container. There is one EntityManagerFactory per deployment.

Author
gyorke
Since
TopLink Essentials - JPA 1.0
See Also
jakarta.persistence.EntityManager, org.eclipse.persistence.jpa.JpaEntityManager, org.eclipse.persistence.jpa.JpaEntityManagerFactory

Field Summary

Modifier and TypeField and Description
protected boolean
beginEarlyTransaction

Default join existing transaction property, allows reading through write connection.

protected boolean
closeOnCommit

Default property to avoid resuming unit of work if going to be closed on commit anyway.

protected UnitOfWork.CommitOrderType
commitOrder

Order updates by id to avoid potential deadlocks.

protected boolean
protected String
flushClearCache

Default FlashClearCache mode to be used.

protected FlushModeType
flushMode

Default property, allows flush before query to be avoided.

protected boolean
isOpen

Stores if closed has been called.

protected Cache
myCache

Reference to Cache Interface.

protected JpaEntityManagerFactory
owner

Pointer to the EntityManagerFactoryImpl that created me

protected boolean
persistOnCommit

Default property to avoid discover new objects in unit of work if application always uses persist.

protected Map<K, V>
properties

Persistence unit properties from create factory.

protected ReferenceMode
referenceMode

Default property, allows weak unit of work references.

protected volatile AbstractSession
session

Reference to the ServerSession for this deployment.

protected EntityManagerSetupImpl
setupImpl

EntityManagerSetupImpl that deployed this factory.

protected boolean
shouldValidateExistence

Default to determine if does-exist should be performed on persist.

protected static final Set<String>
supportedNonServerSessionProperties

INTERNAL: The following properties passed to createEMF cached and processed on the emf directly.

Constructor Summary

AccessConstructor and Description
public
EntityManagerFactoryDelegate(AbstractSession databaseSession, JpaEntityManagerFactory owner)

Will return an instance of the Factory.

public
public
EntityManagerFactoryDelegate(String persistenceUnitName, Map<String, Object> properties, List<ClassDescriptor> descriptors, JpaEntityManagerFactory owner)

Create a dynamic persistence unit which does not use the persistence.xml.

Method Summary

Modifier and TypeMethod and Description
public <T> void
addNamedEntityGraph(String
name for the entity graph
graphName
,
EntityGraph<T>
entity graph
entityGraph
)

Implements jakarta.persistence.EntityManagerFactory.addNamedEntityGraph.

Add a named copy of the EntityGraph to the EntityManagerFactory.
public void
addNamedQuery(String
name for the query
name
,
Query
Query, TypedQuery, or StoredProcedureQuery object
query
)

Implements jakarta.persistence.EntityManagerFactory.addNamedQuery.

Define the query, typed query, or stored procedure query as a named query such that future query objects can be created from it using the createNamedQuery or createNamedStoredProcedureQuery method.
public synchronized void
close()

Implements jakarta.persistence.EntityManagerFactory.close, java.lang.AutoCloseable.close.

Closes this factory, releasing any resources that might be held by this factory.
public EntityManager
createEntityManager()

Implements jakarta.persistence.EntityManagerFactory.createEntityManager.

PUBLIC: Returns an EntityManager for this deployment.
public EntityManager
createEntityManager(Map<K, V>
properties for entity manager
properties
)

Implements jakarta.persistence.EntityManagerFactory.createEntityManager.

PUBLIC: Returns an EntityManager for this deployment.
public EntityManager
createEntityManager(SynchronizationType
how and when the entity manager should be synchronized with the current JTA transaction
synchronizationType
,
Map<K, V>
properties for entity manager
map
)

Implements jakarta.persistence.EntityManagerFactory.createEntityManager.

Create a new JTA application-managed EntityManager with the specified synchronization type and map of properties.
public EntityManager
createEntityManager(SynchronizationType
how and when the entity manager should be synchronized with the current JTA transaction
synchronizationType
)

Implements jakarta.persistence.EntityManagerFactory.createEntityManager.

Create a new JTA application-managed EntityManager with the specified synchronization type.
protected EntityManagerImpl
createEntityManagerImpl(Map<K, V> properties, SynchronizationType syncType)

protected void
finalize()

Overrides java.lang.Object.finalize.

Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.
public AbstractSession
getAbstractSession()

INTERNAL: Returns the ServerSession that the Factory will be using and initializes it if it is not available.

public boolean
getBeginEarlyTransaction()

Return default join existing transaction property, allows reading through write connection.

public Cache

Returns:

instance of the Cache interface
getCache
()

Implements jakarta.persistence.EntityManagerFactory.getCache.

Access the cache that is associated with the entity manager factory (the "second level cache").
public boolean
getCloseOnCommit()

Return default property to avoid resuming unit of work if going to be closed on commit anyway.

public UnitOfWork.CommitOrderType
getCommitOrder()

Return if updates should be ordered by primary key, to avoid potential database deadlocks.

public boolean
getCommitWithoutPersistRules()

Return default property to avoid discover new objects in unit of work if application always uses persist.

public CriteriaBuilder
getCriteriaBuilder()

Implements jakarta.persistence.EntityManagerFactory.getCriteriaBuilder.

Return an instance of CriteriaBuilder for the creation of CriteriaQuery objects.
public DatabaseSessionImpl
getDatabaseSession()

Implements org.eclipse.persistence.jpa.JpaEntityManagerFactory.getDatabaseSession.

INTERNAL: Returns the ServerSession that the Factory will be using and initializes it if it is not available.
public String
getFlushClearCache()

Return the default FlashClearCache mode to be used.

public FlushModeType
getFlushMode()

Return default property, allows flush before query to be avoided.

public Object

Returns:

id of the entity
getIdentifier
(Object
entity instance
entity
)

Implements jakarta.persistence.PersistenceUnitUtil.getIdentifier.

Returns the id of the entity.
public Metamodel

Returns:

Metamodel instance
getMetamodel
()

Implements jakarta.persistence.EntityManagerFactory.getMetamodel.

Return an instance of Metamodel interface for access to the metamodel of the persistence unit.
public JpaEntityManagerFactory
getOwner()

INTERNAL: Get the EntityManagerFactoryImpl that created this

public PersistenceUnitUtil

Returns:

PersistenceUnitUtil interface
getPersistenceUnitUtil
()

Implements jakarta.persistence.EntityManagerFactory.getPersistenceUnitUtil.

Return interface providing access to utility methods for the persistence unit.
public boolean
getPersistOnCommit()

Return default property to avoid discover new objects in unit of work if application always uses persist.

public Map<String, Object>
getProperties()

Implements jakarta.persistence.EntityManagerFactory.getProperties.

Get the properties and associated values that are in effect for the entity manager factory.
public Object
getProperty(String name)

The method return user defined property passed in from EntityManagerFactory.

public ReferenceMode
getReferenceMode()

Return default property, allows weak unit of work references.

public ServerSession
getServerSession()

Implements org.eclipse.persistence.jpa.JpaEntityManagerFactory.getServerSession.

INTERNAL: Returns the ServerSession that the Factory will be using and initializes it if it is not available.
public SessionBroker
getSessionBroker()

Implements org.eclipse.persistence.jpa.JpaEntityManagerFactory.getSessionBroker.

INTERNAL: Returns the SessionBroker that the Factory will be using and initializes it if it is not available.
public EntityManagerSetupImpl
getSetupImpl()

INTERNAL: Return the EntityManagerSetupImpl associated with this factory

public boolean

Returns:

false if entity's state has not been loaded or if the attribute state has not been loaded, otherwise true
isLoaded
(Object
containing the attribute
entity
,
String
name of attribute whose load state is to be determined
attributeName
)

Implements jakarta.persistence.PersistenceUnitUtil.isLoaded.

Determine the load state of a given persistent attribute of an entity belonging to the persistence unit.
public boolean

Returns:

false if the entity has not been loaded, else true.
isLoaded
(Object
whose load state is to be determined
entity
)

Implements jakarta.persistence.PersistenceUnitUtil.isLoaded.

Determine the load state of an entity belonging to the persistence unit.
public boolean
isOpen()

Implements jakarta.persistence.EntityManagerFactory.isOpen.

Indicates whether or not this factory is open.
protected void
processProperties(Map<K, V> properties)

Process all EntityManager properties.

public void
refreshMetadata(Map<K, V> properties)

Implements org.eclipse.persistence.jpa.JpaEntityManagerFactory.refreshMetadata.

ADVANCED: Re-bootstrap this factory.
public void
setBeginEarlyTransaction(boolean beginEarlyTransaction)

Set default join existing transaction property, allows reading through write connection.

public void
setCloseOnCommit(boolean closeOnCommit)

Set default property to avoid resuming unit of work if going to be closed on commit anyway.

public void
setCommitOrder(UnitOfWork.CommitOrderType commitOrder)

Set update ordering by primary key, to avoid potential database deadlocks.

public void
setCommitWithoutPersistRules(boolean commitWithoutPersistRules)

Set default property to avoid discover new objects in unit of work if application always uses persist.

public void
setFlushClearCache(String flushClearCache)

Set the default FlashClearCache mode to be used.

public void
setFlushMode(FlushModeType flushMode)

Set default property, allows flush before query to be avoided.

public void
setMetamodel(Metamodel aMetamodel)

INTERNAL: Convenience function to allow us to reset the Metamodel in the possible case that we want to regenerate it.

public void
setPersistOnCommit(boolean persistOnCommit)

Set default property to avoid discover new objects in unit of work if application always uses persist.

public void
setReferenceMode(ReferenceMode referenceMode)

Set default property, allows weak unit of work references.

public void
setShouldValidateExistence(boolean shouldValidateExistence)

Set the default to determine if does-exist should be performed on persist.

public boolean
shouldValidateExistence()

Return the default to determine if does-exist should be performed on persist.

public EntityManagerFactoryDelegate
unwrap()

Implements org.eclipse.persistence.jpa.JpaEntityManagerFactory.unwrap.

Gets the underlying implementation of the EntityManagerFactory.
public <T> T
unwrap(Class<T>
the class of the object to be returned. This is normally either the underlying EntityManagerFactory implementation class or an interface that it implements.
cls
)

Implements jakarta.persistence.EntityManagerFactory.unwrap.

Return an object of the specified type to allow access to the provider-specific API.
protected void
Inherited from java.lang.Object:
cloneequalsgetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

beginEarlyTransactionback to summary
protected boolean beginEarlyTransaction

Default join existing transaction property, allows reading through write connection.

closeOnCommitback to summary
protected boolean closeOnCommit

Default property to avoid resuming unit of work if going to be closed on commit anyway.

commitOrderback to summary
protected UnitOfWork.CommitOrderType commitOrder

Order updates by id to avoid potential deadlocks. Default is true.

commitWithoutPersistRulesback to summary
protected boolean commitWithoutPersistRules
flushClearCacheback to summary
protected String flushClearCache

Default FlashClearCache mode to be used. Relevant only in case call to flush method followed by call to clear method.

See Also
org.eclipse.persistence.config.FlushClearCache
flushModeback to summary
protected FlushModeType flushMode

Default property, allows flush before query to be avoided.

isOpenback to summary
protected boolean isOpen

Stores if closed has been called.

myCacheback to summary
protected Cache myCache

Reference to Cache Interface.

ownerback to summary
protected JpaEntityManagerFactory owner

Pointer to the EntityManagerFactoryImpl that created me

persistOnCommitback to summary
protected boolean persistOnCommit

Default property to avoid discover new objects in unit of work if application always uses persist.

propertiesback to summary
protected Map<K, V> properties

Persistence unit properties from create factory.

referenceModeback to summary
protected ReferenceMode referenceMode

Default property, allows weak unit of work references.

sessionback to summary
protected volatile AbstractSession session

Reference to the ServerSession for this deployment.

setupImplback to summary
protected EntityManagerSetupImpl setupImpl

EntityManagerSetupImpl that deployed this factory.

shouldValidateExistenceback to summary
protected boolean shouldValidateExistence

Default to determine if does-exist should be performed on persist.

supportedNonServerSessionPropertiesback to summary
protected static final Set<String> supportedNonServerSessionProperties

INTERNAL: The following properties passed to createEMF cached and processed on the emf directly. None of these properties processed during predeploy or deploy.

Constructor Detail

EntityManagerFactoryDelegateback to summary
public EntityManagerFactoryDelegate(AbstractSession databaseSession, JpaEntityManagerFactory owner)

Will return an instance of the Factory. Should only be called by EclipseLink.

EntityManagerFactoryDelegateback to summary
public EntityManagerFactoryDelegate(EntityManagerSetupImpl setupImpl, Map<K, V> properties, JpaEntityManagerFactory owner)
EntityManagerFactoryDelegateback to summary
public EntityManagerFactoryDelegate(String persistenceUnitName, Map<String, Object> properties, List<ClassDescriptor> descriptors, JpaEntityManagerFactory owner)

Create a dynamic persistence unit which does not use the persistence.xml. Instead all configuration is driven from the provided persistence unit properties and descriptors.

Method Detail

addNamedEntityGraphback to summary
public <T> void addNamedEntityGraph(String graphName, EntityGraph<T> entityGraph)

Implements jakarta.persistence.EntityManagerFactory.addNamedEntityGraph.

Doc from jakarta.persistence.EntityManagerFactory.addNamedEntityGraph.

Add a named copy of the EntityGraph to the EntityManagerFactory. If an entity graph with the same name already exists, it is replaced.

Parameters
graphName:String

name for the entity graph

entityGraph:EntityGraph<T>

entity graph

Annotations
@Override
addNamedQueryback to summary
public void addNamedQuery(String name, Query query)

Implements jakarta.persistence.EntityManagerFactory.addNamedQuery.

Doc from jakarta.persistence.EntityManagerFactory.addNamedQuery.

Define the query, typed query, or stored procedure query as a named query such that future query objects can be created from it using the createNamedQuery or createNamedStoredProcedureQuery method.

Any configuration of the query object (except for actual parameter binding) in effect when the named query is added is retained as part of the named query definition. This includes configuration information such as max results, hints, flush mode, lock mode, result set mapping information, and information about stored procedure parameters.

When the query is executed, information that can be set by means of the query APIs can be overridden. Information that is overridden does not affect the named query as registered with the entity manager factory, and thus does not affect subsequent query objects created from it by means of the createNamedQuery or createNamedStoredProcedureQuery method.

If a named query of the same name has been previously defined, either statically via metadata or via this method, that query definition is replaced.

Parameters
name:String

name for the query

query:Query

Query, TypedQuery, or StoredProcedureQuery object

Annotations
@Override
closeback to summary
public synchronized void close()

Implements jakarta.persistence.EntityManagerFactory.close, java.lang.AutoCloseable.close.

Closes this factory, releasing any resources that might be held by this factory. After invoking this method, all methods on the instance will throw an IllegalStateException, except for isOpen, which will return false.

Annotations
@Override
createEntityManagerback to summary
public EntityManager createEntityManager()

Implements jakarta.persistence.EntityManagerFactory.createEntityManager.

PUBLIC: Returns an EntityManager for this deployment.

Returns:EntityManager

Doc from jakarta.persistence.EntityManagerFactory.createEntityManager.

entity manager instance

Annotations
@Override
createEntityManagerback to summary
public EntityManager createEntityManager(Map<K, V> properties)

Implements jakarta.persistence.EntityManagerFactory.createEntityManager.

PUBLIC: Returns an EntityManager for this deployment.

Parameters
properties:Map<K, V>

Doc from jakarta.persistence.EntityManagerFactory.createEntityManager.

properties for entity manager

Returns:EntityManager

Doc from jakarta.persistence.EntityManagerFactory.createEntityManager.

entity manager instance

Annotations
@Override
createEntityManagerback to summary
public EntityManager createEntityManager(SynchronizationType synchronizationType, Map<K, V> map)

Implements jakarta.persistence.EntityManagerFactory.createEntityManager.

Doc from jakarta.persistence.EntityManagerFactory.createEntityManager.

Create a new JTA application-managed EntityManager with the specified synchronization type and map of properties. This method returns a new EntityManager instance each time it is invoked. The isOpen method will return true on the returned instance.

Parameters
synchronizationType:SynchronizationType

how and when the entity manager should be synchronized with the current JTA transaction

map:Map<K, V>

properties for entity manager

Returns:EntityManager

entity manager instance

Annotations
@Override
createEntityManagerback to summary
public EntityManager createEntityManager(SynchronizationType synchronizationType)

Implements jakarta.persistence.EntityManagerFactory.createEntityManager.

Doc from jakarta.persistence.EntityManagerFactory.createEntityManager.

Create a new JTA application-managed EntityManager with the specified synchronization type. This method returns a new EntityManager instance each time it is invoked. The isOpen method will return true on the returned instance.

Parameters
synchronizationType:SynchronizationType

how and when the entity manager should be synchronized with the current JTA transaction

Returns:EntityManager

entity manager instance

Annotations
@Override
createEntityManagerImplback to summary
protected EntityManagerImpl createEntityManagerImpl(Map<K, V> properties, SynchronizationType syncType)
finalizeback to summary
protected void finalize() throws Throwable

Overrides java.lang.Object.finalize.

Doc from java.lang.Object.finalize.

Called by the garbage collector on an object when garbage collection determines that there are no more references to the object. A subclass overrides the finalize method to dispose of system resources or to perform other cleanup.

When running in a Java virtual machine in which finalization has been disabled or removed, the garbage collector will never call finalize(). In a Java virtual machine in which finalization is enabled, the garbage collector might call finalize only after an indefinite delay.

The general contract of finalize is that it is invoked if and when the Java virtual machine has determined that there is no longer any means by which this object can be accessed by any thread that has not yet died, except as a result of an action taken by the finalization of some other object or class which is ready to be finalized. The finalize method may take any action, including making this object available again to other threads; the usual purpose of finalize, however, is to perform cleanup actions before the object is irrevocably discarded. For example, the finalize method for an object that represents an input/output connection might perform explicit I/O transactions to break the connection before the object is permanently discarded.

The finalize method of class Object performs no special action; it simply returns normally. Subclasses of Object may override this definition.

The Java programming language does not guarantee which thread will invoke the finalize method for any given object. It is guaranteed, however, that the thread that invokes finalize will not be holding any user-visible synchronization locks when finalize is invoked. If an uncaught exception is thrown by the finalize method, the exception is ignored and finalization of that object terminates.

After the finalize method has been invoked for an object, no further action is taken until the Java virtual machine has again determined that there is no longer any means by which this object can be accessed by any thread that has not yet died, including possible actions by other objects or classes which are ready to be finalized, at which point the object may be discarded.

The finalize method is never invoked more than once by a Java virtual machine for any given object.

Any exception thrown by the finalize method causes the finalization of this object to be halted, but is otherwise ignored.

Annotations
@Override
Exceptions
Throwable:
the Exception raised by this method
getAbstractSessionback to summary
public AbstractSession getAbstractSession()

INTERNAL: Returns the ServerSession that the Factory will be using and initializes it if it is not available. This method makes use of the partially constructed session stored in our setupImpl and completes its construction

getBeginEarlyTransactionback to summary
public boolean getBeginEarlyTransaction()

Return default join existing transaction property, allows reading through write connection.

getCacheback to summary
public Cache getCache()

Implements jakarta.persistence.EntityManagerFactory.getCache.

Access the cache that is associated with the entity manager factory (the "second level cache").

Returns:Cache

instance of the Cache interface

Annotations
@Override
Exceptions
IllegalStateException:
if the entity manager factory has been closed
Since
Java Persistence 2.0
See Also
jakarta.persistence.EntityManagerFactory#getCache()
getCloseOnCommitback to summary
public boolean getCloseOnCommit()

Return default property to avoid resuming unit of work if going to be closed on commit anyway.

getCommitOrderback to summary
public UnitOfWork.CommitOrderType getCommitOrder()

Return if updates should be ordered by primary key, to avoid potential database deadlocks.

getCommitWithoutPersistRulesback to summary
public boolean getCommitWithoutPersistRules()

Return default property to avoid discover new objects in unit of work if application always uses persist.

getCriteriaBuilderback to summary
public CriteriaBuilder getCriteriaBuilder()

Implements jakarta.persistence.EntityManagerFactory.getCriteriaBuilder.

Doc from jakarta.persistence.EntityManagerFactory.getCriteriaBuilder.

Return an instance of CriteriaBuilder for the creation of CriteriaQuery objects.

Returns:CriteriaBuilder

CriteriaBuilder instance

Annotations
@Override
Since
Java Persistence 2.0
See Also
jakarta.persistence.EntityManagerFactory#getCriteriaBuilder()
getDatabaseSessionback to summary
public DatabaseSessionImpl getDatabaseSession()

Implements org.eclipse.persistence.jpa.JpaEntityManagerFactory.getDatabaseSession.

INTERNAL: Returns the ServerSession that the Factory will be using and initializes it if it is not available. This method makes use of the partially constructed session stored in our setupImpl and completes its construction

Annotations
@Override
getFlushClearCacheback to summary
public String getFlushClearCache()

Return the default FlashClearCache mode to be used. Relevant only in case call to flush method followed by call to clear method.

See Also
org.eclipse.persistence.config.FlushClearCache
getFlushModeback to summary
public FlushModeType getFlushMode()

Return default property, allows flush before query to be avoided.

getIdentifierback to summary
public Object getIdentifier(Object entity)

Implements jakarta.persistence.PersistenceUnitUtil.getIdentifier.

Returns the id of the entity. A generated id is not guaranteed to be available until after the database insert has occurred. Returns null if the entity does not yet have an id

Parameters
entity:Object

Doc from jakarta.persistence.PersistenceUnitUtil.getIdentifier.

entity instance

Returns:Object

id of the entity

Annotations
@Override
Exceptions
IllegalArgumentException:
if the entity is found not to be an entity.
getMetamodelback to summary
public Metamodel getMetamodel()

Implements jakarta.persistence.EntityManagerFactory.getMetamodel.

Return an instance of Metamodel interface for access to the metamodel of the persistence unit.

Returns:Metamodel

Metamodel instance

Annotations
@Override
Exceptions
IllegalStateException:
if the entity manager factory has been closed.
Since
Java Persistence 2.0
See Also
jakarta.persistence.EntityManagerFactory#getMetamodel()
getOwnerback to summary
public JpaEntityManagerFactory getOwner()

INTERNAL: Get the EntityManagerFactoryImpl that created this

getPersistenceUnitUtilback to summary
public PersistenceUnitUtil getPersistenceUnitUtil()

Implements jakarta.persistence.EntityManagerFactory.getPersistenceUnitUtil.

Return interface providing access to utility methods for the persistence unit.

Returns:PersistenceUnitUtil

PersistenceUnitUtil interface

Annotations
@Override
Exceptions
IllegalStateException:
if the entity manager factory has been closed.
getPersistOnCommitback to summary
public boolean getPersistOnCommit()

Return default property to avoid discover new objects in unit of work if application always uses persist.

getPropertiesback to summary
public Map<String, Object> getProperties()

Implements jakarta.persistence.EntityManagerFactory.getProperties.

Doc from jakarta.persistence.EntityManagerFactory.getProperties.

Get the properties and associated values that are in effect for the entity manager factory. Changing the contents of the map does not change the configuration in effect.

Returns:Map<String, Object>

properties

Annotations
@Override
Since
Java Persistence API 2.0
See Also
jakarta.persistence.EntityManagerFactory#getProperties()
getPropertyback to summary
public Object getProperty(String name)

The method return user defined property passed in from EntityManagerFactory.

getReferenceModeback to summary
public ReferenceMode getReferenceMode()

Return default property, allows weak unit of work references.

getServerSessionback to summary
public ServerSession getServerSession()

Implements org.eclipse.persistence.jpa.JpaEntityManagerFactory.getServerSession.

INTERNAL: Returns the ServerSession that the Factory will be using and initializes it if it is not available. This method makes use of the partially constructed session stored in our setupImpl and completes its construction TODO: should throw IllegalStateException if not ServerSession

Annotations
@Override
getSessionBrokerback to summary
public SessionBroker getSessionBroker()

Implements org.eclipse.persistence.jpa.JpaEntityManagerFactory.getSessionBroker.

INTERNAL: Returns the SessionBroker that the Factory will be using and initializes it if it is not available. This method makes use of the partially constructed session stored in our setupImpl and completes its construction TODO: should throw IllegalStateException if not SessionBroker

Annotations
@Override
getSetupImplback to summary
public EntityManagerSetupImpl getSetupImpl()

INTERNAL: Return the EntityManagerSetupImpl associated with this factory

isLoadedback to summary
public boolean isLoaded(Object entity, String attributeName)

Implements jakarta.persistence.PersistenceUnitUtil.isLoaded.

Determine the load state of a given persistent attribute of an entity belonging to the persistence unit.

Parameters
entity:Object

containing the attribute

attributeName:String

name of attribute whose load state is to be determined

Returns:boolean

false if entity's state has not been loaded or if the attribute state has not been loaded, otherwise true

Annotations
@Override
isLoadedback to summary
public boolean isLoaded(Object entity)

Implements jakarta.persistence.PersistenceUnitUtil.isLoaded.

Determine the load state of an entity belonging to the persistence unit. This method can be used to determine the load state of an entity passed as a reference. An entity is considered loaded if all attributes for which FetchType EAGER has been specified have been loaded. The isLoaded(Object, String) method should be used to determine the load state of an attribute. Not doing so might lead to unintended loading of state.

Parameters
entity:Object

whose load state is to be determined

Returns:boolean

false if the entity has not been loaded, else true.

Annotations
@Override
isOpenback to summary
public boolean isOpen()

Implements jakarta.persistence.EntityManagerFactory.isOpen.

Indicates whether or not this factory is open. Returns true until a call to close is made.

Returns:boolean

Doc from jakarta.persistence.EntityManagerFactory.isOpen.

boolean indicating whether the factory is open

Annotations
@Override
processPropertiesback to summary
protected void processProperties(Map<K, V> properties)

Process all EntityManager properties. This allows all EntityManager properties specified in the persistence.xml, factory properties, or System properties to be preprocessed. This save the cost of processing these properties each time an EntityManager is created, which can add considerable overhead to both performance and concurrency as System properties are a Hashtable and synchronized. ATTENTION: If you add a new property to be processed in this method please also add the property's name to PersistenceUnitProperties.supportedNonServerSessionProperties

refreshMetadataback to summary
public void refreshMetadata(Map<K, V> properties)

Implements org.eclipse.persistence.jpa.JpaEntityManagerFactory.refreshMetadata.

ADVANCED: Re-bootstrap this factory. This method will rebuild the EntityManagerFactory. It should be used in conjunction with a MetadataSource to allow mappings to be changed in a running system. All existing EntityMangers will continue to function with the old metadata, but new factories will use the new metadata. This call will throw an exception when called on EntityManagerFactoryImplDelegate

Annotations
@Override
setBeginEarlyTransactionback to summary
public void setBeginEarlyTransaction(boolean beginEarlyTransaction)

Set default join existing transaction property, allows reading through write connection.

setCloseOnCommitback to summary
public void setCloseOnCommit(boolean closeOnCommit)

Set default property to avoid resuming unit of work if going to be closed on commit anyway.

setCommitOrderback to summary
public void setCommitOrder(UnitOfWork.CommitOrderType commitOrder)

Set update ordering by primary key, to avoid potential database deadlocks.

setCommitWithoutPersistRulesback to summary
public void setCommitWithoutPersistRules(boolean commitWithoutPersistRules)

Set default property to avoid discover new objects in unit of work if application always uses persist.

setFlushClearCacheback to summary
public void setFlushClearCache(String flushClearCache)

Set the default FlashClearCache mode to be used. Relevant only in case call to flush method followed by call to clear method.

See Also
org.eclipse.persistence.config.FlushClearCache
setFlushModeback to summary
public void setFlushMode(FlushModeType flushMode)

Set default property, allows flush before query to be avoided.

setMetamodelback to summary
public void setMetamodel(Metamodel aMetamodel)

INTERNAL: Convenience function to allow us to reset the Metamodel in the possible case that we want to regenerate it. This function is outside of the JPA 2.0 specification.

Since
Java Persistence 2.0
setPersistOnCommitback to summary
public void setPersistOnCommit(boolean persistOnCommit)

Set default property to avoid discover new objects in unit of work if application always uses persist.

setReferenceModeback to summary
public void setReferenceMode(ReferenceMode referenceMode)

Set default property, allows weak unit of work references.

setShouldValidateExistenceback to summary
public void setShouldValidateExistence(boolean shouldValidateExistence)

Set the default to determine if does-exist should be performed on persist.

shouldValidateExistenceback to summary
public boolean shouldValidateExistence()

Return the default to determine if does-exist should be performed on persist.

unwrapback to summary
public EntityManagerFactoryDelegate unwrap()

Implements org.eclipse.persistence.jpa.JpaEntityManagerFactory.unwrap.

Gets the underlying implementation of the EntityManagerFactory. This method will return a version of EntityManagerFactory that is based on the available metadata at the time it is called. Future calls to refresh will not affect that metadata on this EntityManagerFactory.

Annotations
@Override
unwrapback to summary
public <T> T unwrap(Class<T> cls)

Implements jakarta.persistence.EntityManagerFactory.unwrap.

Doc from jakarta.persistence.EntityManagerFactory.unwrap.

Return an object of the specified type to allow access to the provider-specific API. If the provider's EntityManagerFactory implementation does not support the specified class, the PersistenceException is thrown.

Parameters
cls:Class<T>

the class of the object to be returned. This is normally either the underlying EntityManagerFactory implementation class or an interface that it implements.

Returns:T

an instance of the specified class

Annotations
@Override
verifyOpenback to summary
protected void verifyOpen()