public class EntityManagerFactoryImpl extends java.lang.Object implements javax.persistence.EntityManagerFactory, javax.persistence.PersistenceUnitUtil, JpaEntityManagerFactory
| Constructor and Description |
|---|
EntityManagerFactoryImpl(AbstractSession session)
Will return an instance of the Factory.
|
EntityManagerFactoryImpl(EntityManagerSetupImpl setupImpl,
java.util.Map properties) |
EntityManagerFactoryImpl(java.lang.String persistenceUnitName,
java.util.Map<java.lang.String,java.lang.Object> properties,
java.util.List<ClassDescriptor> descriptors)
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) |
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 possible 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()
Returns the DatabaseSession 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.
|
static java.lang.Object |
getIdentifier(java.lang.Object entity,
AbstractSession session)
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.
|
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.
|
boolean |
isLoaded(java.lang.Object entity)
Determine the load state of an entity belonging to the persistence unit.
|
static java.lang.Boolean |
isLoaded(java.lang.Object entity,
AbstractSession session)
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.
|
static java.lang.Boolean |
isLoaded(java.lang.Object entity,
java.lang.String attributeName,
AbstractSession session)
Determine the load state of a given persistent attribute of an entity
belonging to the persistence unit.
|
static boolean |
isLoaded(java.lang.Object entity,
java.lang.String attributeName,
DatabaseMapping mapping)
Check whether a named attribute on a given entity with a given mapping
has been loaded.
|
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 updates should be ordered by primary key to avoid possible 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 EntityManagerFactoryImpl(AbstractSession session)
serverSession - public EntityManagerFactoryImpl(EntityManagerSetupImpl setupImpl, java.util.Map properties)
public EntityManagerFactoryImpl(java.lang.String persistenceUnitName,
java.util.Map<java.lang.String,java.lang.Object> properties,
java.util.List<ClassDescriptor> descriptors)
public static java.lang.Object getIdentifier(java.lang.Object entity,
AbstractSession session)
entity - java.lang.IllegalArgumentException - if the entity is found not to be an entity.public static java.lang.Boolean isLoaded(java.lang.Object entity,
AbstractSession session)
entity - whose load state is to be determinedpublic static java.lang.Boolean isLoaded(java.lang.Object entity,
java.lang.String attributeName,
AbstractSession session)
entity - containing the attributeattributeName - name of attribute whose load state is to be determinedpublic static boolean isLoaded(java.lang.Object entity,
java.lang.String attributeName,
DatabaseMapping mapping)
entity - attributeName - mapping - public void refreshMetadata(java.util.Map properties)
refreshMetadata in interface JpaEntityManagerFactoryproperties - public SessionBroker getSessionBroker()
getSessionBroker in interface JpaEntityManagerFactorypublic ServerSession getServerSession()
getServerSession 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)
createEntityManager in interface javax.persistence.EntityManagerFactorypublic javax.persistence.EntityManager createEntityManager(javax.persistence.SynchronizationType synchronizationType,
java.util.Map map)
createEntityManager in interface javax.persistence.EntityManagerFactorypublic EntityManagerFactoryDelegate unwrap()
unwrap in interface JpaEntityManagerFactorypublic java.lang.Object getProperty(java.lang.String name)
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 DatabaseSessionImpl getDatabaseSession()
JpaEntityManagerFactorygetDatabaseSession in interface JpaEntityManagerFactorypublic 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 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.IllegalStateException - 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