public class EntityManagerFactoryDelegate extends java.lang.Object implements javax.persistence.EntityManagerFactory, javax.persistence.PersistenceUnitUtil, JpaEntityManagerFactory
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.
EntityManager,
JpaEntityManager,
org.eclipse.persistence.jpa.EntityManagerFactory| Constructor and Description |
|---|
EntityManagerFactoryDelegate(AbstractSession databaseSession,
JpaEntityManagerFactory owner)
Will return an instance of the Factory.
|
EntityManagerFactoryDelegate(EntityManagerSetupImpl setupImpl,
java.util.Map properties,
JpaEntityManagerFactory owner) |
EntityManagerFactoryDelegate(java.lang.String persistenceUnitName,
java.util.Map<java.lang.String,java.lang.Object> properties,
java.util.List<ClassDescriptor> descriptors,
JpaEntityManagerFactory owner)
Create a dynamic persistence unit which does not use the persistence.xml.
|
| Modifier and Type | Method and Description |
|---|---|
<T> void |
addNamedEntityGraph(java.lang.String graphName,
javax.persistence.EntityGraph<T> entityGraph) |
void |
addNamedQuery(java.lang.String name,
javax.persistence.Query query) |
void |
close()
Closes this factory, releasing any resources that might be held by this
factory.
|
javax.persistence.EntityManager |
createEntityManager()
PUBLIC: Returns an EntityManager for this deployment.
|
javax.persistence.EntityManager |
createEntityManager(java.util.Map properties)
PUBLIC: Returns an EntityManager for this deployment.
|
javax.persistence.EntityManager |
createEntityManager(javax.persistence.SynchronizationType synchronizationType) |
javax.persistence.EntityManager |
createEntityManager(javax.persistence.SynchronizationType synchronizationType,
java.util.Map map) |
AbstractSession |
getAbstractSession()
INTERNAL: Returns the ServerSession that the Factory will be using and
initializes it if it is not available.
|
boolean |
getBeginEarlyTransaction()
Return default join existing transaction property, allows reading through
write connection.
|
javax.persistence.Cache |
getCache()
Access the cache that is associated with the entity manager
factory (the "second level cache").
|
boolean |
getCloseOnCommit()
Return default property to avoid resuming unit of work if going to be
closed on commit anyway.
|
UnitOfWork.CommitOrderType |
getCommitOrder()
Return if updates should be ordered by primary key, to avoid potential database deadlocks.
|
boolean |
getCommitWithoutPersistRules()
Return default property to avoid discover new objects in unit of work if
application always uses persist.
|
javax.persistence.criteria.CriteriaBuilder |
getCriteriaBuilder() |
DatabaseSessionImpl |
getDatabaseSession()
INTERNAL: Returns the ServerSession that the Factory will be using and
initializes it if it is not available.
|
java.lang.String |
getFlushClearCache()
Return the default FlashClearCache mode to be used.
|
javax.persistence.FlushModeType |
getFlushMode()
Return default property, allows flush before query to be avoided.
|
java.lang.Object |
getIdentifier(java.lang.Object entity)
Returns the id of the entity.
|
javax.persistence.metamodel.Metamodel |
getMetamodel()
Return an instance of Metamodel interface for access to the metamodel of
the persistence unit.
|
JpaEntityManagerFactory |
getOwner()
INTERNAL:
Get the EntityManagerFactoryImpl that created this
|
javax.persistence.PersistenceUnitUtil |
getPersistenceUnitUtil()
Return interface providing access to utility methods for the persistence
unit.
|
boolean |
getPersistOnCommit()
Return default property to avoid discover new objects in unit of work if
application always uses persist.
|
java.util.Map<java.lang.String,java.lang.Object> |
getProperties() |
java.lang.Object |
getProperty(java.lang.String name)
The method return user defined property passed in from
EntityManagerFactory.
|
ReferenceMode |
getReferenceMode()
Return default property, allows weak unit of work references.
|
ServerSession |
getServerSession()
INTERNAL: Returns the ServerSession that the Factory will be using and
initializes it if it is not available.
|
SessionBroker |
getSessionBroker()
INTERNAL: Returns the SessionBroker that the Factory will be using and
initializes it if it is not available.
|
EntityManagerSetupImpl |
getSetupImpl()
INTERNAL:
Return the EntityManagerSetupImpl associated with this factory
|
boolean |
isLoaded(java.lang.Object entity)
Determine the load state of an entity belonging to the persistence unit.
|
boolean |
isLoaded(java.lang.Object entity,
java.lang.String attributeName)
Determine the load state of a given persistent attribute of an entity
belonging to the persistence unit.
|
boolean |
isOpen()
Indicates whether or not this factory is open.
|
void |
refreshMetadata(java.util.Map properties)
ADVANCED:
Re-bootstrap this factory.
|
void |
setBeginEarlyTransaction(boolean beginEarlyTransaction)
Set default join existing transaction property, allows reading through
write connection.
|
void |
setCloseOnCommit(boolean closeOnCommit)
Set default property to avoid resuming unit of work if going to be closed
on commit anyway.
|
void |
setCommitOrder(UnitOfWork.CommitOrderType commitOrder)
Set update ordering by primary key, to avoid potential database deadlocks.
|
void |
setCommitWithoutPersistRules(boolean commitWithoutPersistRules)
Set default property to avoid discover new objects in unit of work if
application always uses persist.
|
void |
setFlushClearCache(java.lang.String flushClearCache)
Set the default FlashClearCache mode to be used.
|
void |
setFlushMode(javax.persistence.FlushModeType flushMode)
Set default property, allows flush before query to be avoided.
|
void |
setMetamodel(javax.persistence.metamodel.Metamodel aMetamodel)
INTERNAL: Convenience function to allow us to reset the Metamodel in the
possible case that we want to regenerate it.
|
void |
setPersistOnCommit(boolean persistOnCommit)
Set default property to avoid discover new objects in unit of work if
application always uses persist.
|
void |
setReferenceMode(ReferenceMode referenceMode)
Set default property, allows weak unit of work references.
|
void |
setShouldValidateExistence(boolean shouldValidateExistence)
Set the default to determine if does-exist should be performed on
persist.
|
boolean |
shouldValidateExistence()
Return the default to determine if does-exist should be performed on
persist.
|
EntityManagerFactoryDelegate |
unwrap()
Gets the underlying implementation of the EntityManagerFactory.
|
<T> T |
unwrap(java.lang.Class<T> cls) |
public EntityManagerFactoryDelegate(AbstractSession databaseSession, JpaEntityManagerFactory owner)
serverSession - public EntityManagerFactoryDelegate(EntityManagerSetupImpl setupImpl, java.util.Map properties, JpaEntityManagerFactory owner)
public EntityManagerFactoryDelegate(java.lang.String persistenceUnitName,
java.util.Map<java.lang.String,java.lang.Object> properties,
java.util.List<ClassDescriptor> descriptors,
JpaEntityManagerFactory owner)
public DatabaseSessionImpl getDatabaseSession()
getDatabaseSession in interface JpaEntityManagerFactorypublic AbstractSession getAbstractSession()
public EntityManagerSetupImpl getSetupImpl()
public ServerSession getServerSession()
getServerSession in interface JpaEntityManagerFactorypublic SessionBroker getSessionBroker()
getSessionBroker in interface JpaEntityManagerFactorypublic void close()
IllegalStateException, except for isOpen, which
will return false.close in interface javax.persistence.EntityManagerFactorypublic boolean isOpen()
true
until a call to close() is made.isOpen in interface javax.persistence.EntityManagerFactorypublic javax.persistence.EntityManager createEntityManager()
createEntityManager in interface javax.persistence.EntityManagerFactorypublic javax.persistence.EntityManager createEntityManager(java.util.Map properties)
createEntityManager in interface javax.persistence.EntityManagerFactorypublic javax.persistence.EntityManager createEntityManager(javax.persistence.SynchronizationType synchronizationType,
java.util.Map map)
createEntityManager in interface javax.persistence.EntityManagerFactorypublic javax.persistence.EntityManager createEntityManager(javax.persistence.SynchronizationType synchronizationType)
createEntityManager in interface javax.persistence.EntityManagerFactorypublic EntityManagerFactoryDelegate unwrap()
unwrap in interface JpaEntityManagerFactorypublic java.lang.Object getProperty(java.lang.String name)
public void refreshMetadata(java.util.Map properties)
refreshMetadata in interface JpaEntityManagerFactoryproperties - public boolean getBeginEarlyTransaction()
public void setBeginEarlyTransaction(boolean beginEarlyTransaction)
public javax.persistence.FlushModeType getFlushMode()
public void setFlushMode(javax.persistence.FlushModeType flushMode)
public ReferenceMode getReferenceMode()
public void setReferenceMode(ReferenceMode referenceMode)
public boolean getCloseOnCommit()
public void setCloseOnCommit(boolean closeOnCommit)
public boolean getPersistOnCommit()
public javax.persistence.PersistenceUnitUtil getPersistenceUnitUtil()
getPersistenceUnitUtil in interface javax.persistence.EntityManagerFactoryjava.lang.IllegalStateException - if the entity manager factory has been closed.public void setPersistOnCommit(boolean persistOnCommit)
public boolean getCommitWithoutPersistRules()
public void setCommitWithoutPersistRules(boolean commitWithoutPersistRules)
public java.lang.String getFlushClearCache()
FlushClearCachepublic void setFlushClearCache(java.lang.String flushClearCache)
FlushClearCachepublic boolean shouldValidateExistence()
public void setShouldValidateExistence(boolean shouldValidateExistence)
public javax.persistence.Cache getCache()
getCache in interface javax.persistence.EntityManagerFactoryCache interfacejava.lang.IllegalStateException - if the entity manager factory has been closedEntityManagerFactory.getCache()public java.util.Map<java.lang.String,java.lang.Object> getProperties()
getProperties in interface javax.persistence.EntityManagerFactoryEntityManagerFactory.getProperties()public javax.persistence.criteria.CriteriaBuilder getCriteriaBuilder()
getCriteriaBuilder in interface javax.persistence.EntityManagerFactoryEntityManagerFactory.getCriteriaBuilder()public javax.persistence.metamodel.Metamodel getMetamodel()
getMetamodel in interface javax.persistence.EntityManagerFactoryjava.lang.IllegalStateException - if the entity manager factory has been closed.EntityManagerFactory.getMetamodel()public JpaEntityManagerFactory getOwner()
public void setMetamodel(javax.persistence.metamodel.Metamodel aMetamodel)
aMetamodel - public boolean isLoaded(java.lang.Object entity,
java.lang.String attributeName)
isLoaded in interface javax.persistence.PersistenceUnitUtilisLoaded in interface javax.persistence.PersistenceUtilentity - containing the attributeattributeName - name of attribute whose load state is to be determinedpublic boolean isLoaded(java.lang.Object entity)
isLoaded in interface javax.persistence.PersistenceUnitUtilisLoaded in interface javax.persistence.PersistenceUtilentity - whose load state is to be determinedpublic java.lang.Object getIdentifier(java.lang.Object entity)
getIdentifier in interface javax.persistence.PersistenceUnitUtilentity - java.lang.IllegalArgumentException - if the entity is found not to be an entity.public UnitOfWork.CommitOrderType getCommitOrder()
public void setCommitOrder(UnitOfWork.CommitOrderType commitOrder)
public void addNamedQuery(java.lang.String name,
javax.persistence.Query query)
addNamedQuery in interface javax.persistence.EntityManagerFactorypublic <T> T unwrap(java.lang.Class<T> cls)
unwrap in interface javax.persistence.EntityManagerFactorypublic <T> void addNamedEntityGraph(java.lang.String graphName,
javax.persistence.EntityGraph<T> entityGraph)
addNamedEntityGraph in interface javax.persistence.EntityManagerFactoryEclipseLink 2.6.3, "build v20160428-59c81c5" API Reference