public class EntityManagerFactoryImpl extends java.lang.Object implements JpaEntityManagerFactory
| Modifier and Type | Field and Description |
|---|---|
protected EntityManagerFactoryDelegate |
delegate |
| Constructor and Description |
|---|
EntityManagerFactoryImpl(AbstractSession serverSession)
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,
<any> entityGraph) |
void |
addNamedQuery(java.lang.String name,
Query query) |
void |
close()
Closes this factory, releasing any resources that might be held by this
factory.
|
EntityManager |
createEntityManager()
PUBLIC: Returns an EntityManager for this deployment.
|
EntityManager |
createEntityManager(java.util.Map properties)
PUBLIC: Returns an EntityManager for this deployment.
|
EntityManager |
createEntityManager(SynchronizationType synchronizationType) |
EntityManager |
createEntityManager(SynchronizationType synchronizationType,
java.util.Map map) |
protected EntityManagerImpl |
createEntityManagerImpl(java.util.Map properties,
SynchronizationType syncType) |
boolean |
getBeginEarlyTransaction()
Return default join existing transaction property, allows reading through
write connection.
|
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.
|
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.
|
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.
|
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.
|
Metamodel |
getMetamodel()
Return an instance of Metamodel interface for access to the metamodel of
the persistence unit.
|
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.
|
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<java.lang.String,java.lang.Object> 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(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(FlushModeType flushMode)
Set default property, allows flush before query to be avoided.
|
void |
setMetamodel(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) |
protected void |
verifyOpen() |
protected EntityManagerFactoryDelegate delegate
public EntityManagerFactoryImpl(AbstractSession serverSession)
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<java.lang.String,java.lang.Object> 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.public boolean isOpen()
true
until a call to close() is made.public EntityManager createEntityManager()
public EntityManager createEntityManager(java.util.Map properties)
public EntityManager createEntityManager(SynchronizationType synchronizationType)
public EntityManager createEntityManager(SynchronizationType synchronizationType,
java.util.Map map)
protected EntityManagerImpl createEntityManagerImpl(java.util.Map properties, SynchronizationType syncType)
public EntityManagerFactoryDelegate unwrap()
unwrap in interface JpaEntityManagerFactoryprotected void verifyOpen()
public java.lang.Object getProperty(java.lang.String name)
public boolean getBeginEarlyTransaction()
public void setBeginEarlyTransaction(boolean beginEarlyTransaction)
public FlushModeType getFlushMode()
public void setFlushMode(FlushModeType flushMode)
public ReferenceMode getReferenceMode()
public void setReferenceMode(ReferenceMode referenceMode)
public boolean getCloseOnCommit()
public void setCloseOnCommit(boolean closeOnCommit)
public boolean getPersistOnCommit()
public PersistenceUnitUtil getPersistenceUnitUtil()
java.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()
org.eclipse.persistence.config.FlushClearCachepublic void setFlushClearCache(java.lang.String flushClearCache)
org.eclipse.persistence.config.FlushClearCachepublic boolean shouldValidateExistence()
public void setShouldValidateExistence(boolean shouldValidateExistence)
public Cache getCache()
Cache interfacejava.lang.IllegalStateException - if the entity manager factory has been closedjavax.persistence.EntityManagerFactory#getCache()public java.util.Map<java.lang.String,java.lang.Object> getProperties()
javax.persistence.EntityManagerFactory#getProperties()public DatabaseSessionImpl getDatabaseSession()
JpaEntityManagerFactorygetDatabaseSession in interface JpaEntityManagerFactorypublic CriteriaBuilder getCriteriaBuilder()
javax.persistence.EntityManagerFactory#getCriteriaBuilder()public Metamodel getMetamodel()
java.lang.IllegalStateException - if the entity manager factory has been closed.javax.persistence.EntityManagerFactory#getMetamodel()public void setMetamodel(Metamodel aMetamodel)
aMetamodel - public boolean isLoaded(java.lang.Object entity)
entity - whose load state is to be determinedpublic java.lang.Object getIdentifier(java.lang.Object entity)
entity - java.lang.IllegalStateException - if the entity is found not to be an entity.public CommitOrderType getCommitOrder()
public void setCommitOrder(CommitOrderType commitOrder)
public void addNamedQuery(java.lang.String name,
Query query)
public <T> T unwrap(java.lang.Class<T> cls)
public <T> void addNamedEntityGraph(java.lang.String graphName,
<any> entityGraph)