public class EntityManagerFactoryImpl extends Object implements OpenJPAEntityManagerFactory, OpenJPAEntityManagerFactorySPI, Closeable, javax.persistence.PersistenceUnitUtil
EntityManagerFactory
that acts as a
facade to a BrokerFactory
.CONN_RETAIN_ALWAYS, CONN_RETAIN_DEMAND, CONN_RETAIN_TRANS
Constructor and Description |
---|
EntityManagerFactoryImpl()
Default constructor provided for auto-instantiation.
|
EntityManagerFactoryImpl(BrokerFactory factory)
Supply delegate on construction.
|
Modifier and Type | Method and Description |
---|---|
void |
addLifecycleListener(Object listener,
Class... classes)
Register a listener for lifecycle-related events on the specified
classes.
|
<T> void |
addNamedEntityGraph(String graphName,
javax.persistence.EntityGraph<T> entityGraph) |
void |
addNamedQuery(String name,
javax.persistence.Query query) |
void |
addTransactionListener(Object listener)
Register a listener for transaction-related events on the specified
classes.
|
void |
close() |
OpenJPAEntityManagerSPI |
createEntityManager() |
OpenJPAEntityManagerSPI |
createEntityManager(Map props)
Return an entity manager with the provided additional configuration
settings.
|
OpenJPAEntityManagerSPI |
createEntityManager(javax.persistence.SynchronizationType synchronizationType) |
OpenJPAEntityManagerSPI |
createEntityManager(javax.persistence.SynchronizationType synchronizationType,
Map props)
Creates and configures a entity manager with the given properties.
|
boolean |
equals(Object other) |
BrokerFactory |
getBrokerFactory()
Delegate.
|
javax.persistence.Cache |
getCache() |
OpenJPAConfiguration |
getConfiguration()
Return the configuration for this factory.
|
OpenJPACriteriaBuilder |
getCriteriaBuilder()
Gets the QueryBuilder with OpenJPA-extended capabilities.
|
OpenJPAQueryBuilder |
getDynamicQueryBuilder()
Gets a builder for dynamic queries.
|
Object |
getIdentifier(Object entity)
Get the identifier for the specified entity.
|
MetamodelImpl |
getMetamodel() |
javax.persistence.PersistenceUnitUtil |
getPersistenceUnitUtil() |
Map<String,Object> |
getProperties()
Return properties describing this runtime.
|
QueryResultCache |
getQueryResultCache()
Access query result cache.
|
StoreCache |
getStoreCache()
Access the level 2 store cache.
|
StoreCache |
getStoreCache(String cacheName)
Access a named level 2 store cache.
|
Set<String> |
getSupportedProperties()
Get the properties supported by this runtime.
|
Object |
getUserObject(Object key)
Get the value for the specified key from the map of user objects.
|
int |
hashCode() |
boolean |
isLoaded(Object entity) |
boolean |
isLoaded(Object entity,
String attribute) |
boolean |
isOpen() |
protected EntityManagerImpl |
newEntityManagerImpl(Broker broker)
Create a new entity manager around the given broker.
|
Object |
putUserObject(Object key,
Object val)
Put the specified key-value pair into the map of user objects.
|
void |
removeLifecycleListener(Object listener)
Remove a listener for lifecycle-related events.
|
void |
removeTransactionListener(Object listener)
Remove a listener for transaction-related events.
|
void |
setBrokerFactory(BrokerFactory factory)
Delegate must be provided before use.
|
<T> T |
unwrap(Class<T> cls) |
public EntityManagerFactoryImpl()
public EntityManagerFactoryImpl(BrokerFactory factory)
public BrokerFactory getBrokerFactory()
public void setBrokerFactory(BrokerFactory factory)
public OpenJPAConfiguration getConfiguration()
OpenJPAEntityManagerFactorySPI
getConfiguration
in interface OpenJPAEntityManagerFactory
getConfiguration
in interface OpenJPAEntityManagerFactorySPI
public Map<String,Object> getProperties()
OpenJPAEntityManagerFactory
getProperties
in interface javax.persistence.EntityManagerFactory
getProperties
in interface OpenJPAEntityManagerFactory
public Object putUserObject(Object key, Object val)
OpenJPAEntityManagerFactory
putUserObject
in interface OpenJPAEntityManagerFactory
public Object getUserObject(Object key)
OpenJPAEntityManagerFactory
getUserObject
in interface OpenJPAEntityManagerFactory
public StoreCache getStoreCache()
OpenJPAEntityManagerFactory
getStoreCache
in interface OpenJPAEntityManagerFactory
public StoreCache getStoreCache(String cacheName)
OpenJPAEntityManagerFactory
getStoreCache
in interface OpenJPAEntityManagerFactory
public QueryResultCache getQueryResultCache()
OpenJPAEntityManagerFactory
getQueryResultCache
in interface OpenJPAEntityManagerFactory
public OpenJPAEntityManagerSPI createEntityManager()
createEntityManager
in interface javax.persistence.EntityManagerFactory
createEntityManager
in interface OpenJPAEntityManagerFactory
createEntityManager
in interface OpenJPAEntityManagerFactorySPI
public OpenJPAEntityManagerSPI createEntityManager(javax.persistence.SynchronizationType synchronizationType)
createEntityManager
in interface javax.persistence.EntityManagerFactory
public OpenJPAEntityManagerSPI createEntityManager(Map props)
OpenJPAEntityManagerFactory
createEntityManager
in interface javax.persistence.EntityManagerFactory
createEntityManager
in interface OpenJPAEntityManagerFactory
createEntityManager
in interface OpenJPAEntityManagerFactorySPI
public OpenJPAEntityManagerSPI createEntityManager(javax.persistence.SynchronizationType synchronizationType, Map props)
createEntityManager
in interface javax.persistence.EntityManagerFactory
protected EntityManagerImpl newEntityManagerImpl(Broker broker)
public void addLifecycleListener(Object listener, Class... classes)
OpenJPAEntityManagerFactorySPI
org.apache.openjpa.event
package for
listener types.addLifecycleListener
in interface OpenJPAEntityManagerFactory
addLifecycleListener
in interface OpenJPAEntityManagerFactorySPI
public void removeLifecycleListener(Object listener)
OpenJPAEntityManagerFactorySPI
removeLifecycleListener
in interface OpenJPAEntityManagerFactory
removeLifecycleListener
in interface OpenJPAEntityManagerFactorySPI
public void addTransactionListener(Object listener)
OpenJPAEntityManagerFactorySPI
org.apache.openjpa.event
package for
listener types.addTransactionListener
in interface OpenJPAEntityManagerFactory
addTransactionListener
in interface OpenJPAEntityManagerFactorySPI
public void removeTransactionListener(Object listener)
OpenJPAEntityManagerFactorySPI
removeTransactionListener
in interface OpenJPAEntityManagerFactory
removeTransactionListener
in interface OpenJPAEntityManagerFactorySPI
public void close()
public boolean isOpen()
isOpen
in interface javax.persistence.EntityManagerFactory
public javax.persistence.Cache getCache()
getCache
in interface javax.persistence.EntityManagerFactory
public OpenJPACriteriaBuilder getCriteriaBuilder()
OpenJPAEntityManagerFactory
getCriteriaBuilder
in interface javax.persistence.EntityManagerFactory
getCriteriaBuilder
in interface OpenJPAEntityManagerFactory
public OpenJPAQueryBuilder getDynamicQueryBuilder()
OpenJPAEntityManagerFactory
getDynamicQueryBuilder
in interface OpenJPAEntityManagerFactory
public Set<String> getSupportedProperties()
OpenJPAEntityManagerFactory
getSupportedProperties
in interface OpenJPAEntityManagerFactory
public MetamodelImpl getMetamodel()
getMetamodel
in interface javax.persistence.EntityManagerFactory
public javax.persistence.PersistenceUnitUtil getPersistenceUnitUtil()
getPersistenceUnitUtil
in interface javax.persistence.EntityManagerFactory
public void addNamedQuery(String name, javax.persistence.Query query)
addNamedQuery
in interface javax.persistence.EntityManagerFactory
public <T> T unwrap(Class<T> cls)
unwrap
in interface javax.persistence.EntityManagerFactory
public <T> void addNamedEntityGraph(String graphName, javax.persistence.EntityGraph<T> entityGraph)
addNamedEntityGraph
in interface javax.persistence.EntityManagerFactory
public Object getIdentifier(Object entity)
getIdentifier
in interface javax.persistence.PersistenceUnitUtil
public boolean isLoaded(Object entity)
isLoaded
in interface javax.persistence.PersistenceUnitUtil
isLoaded
in interface javax.persistence.PersistenceUtil
Copyright © 2006–2020 Apache Software Foundation. All rights reserved.