public class EntityManagerFactoryImpl extends Object implements OpenJPAEntityManagerFactory, OpenJPAEntityManagerFactorySPI, Closeable, 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.
|
void |
addTransactionListener(Object listener)
Register a listener for transaction-related events on the specified
classes.
|
void |
close() |
OpenJPAEntityManagerSPI |
createEntityManager() |
OpenJPAEntityManagerSPI |
createEntityManager(Map props)
Creates and configures a entity manager with the given properties.
|
boolean |
equals(Object other) |
BrokerFactory |
getBrokerFactory()
Delegate.
|
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() |
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.
|
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 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 EntityManagerFactory
createEntityManager
in interface OpenJPAEntityManagerFactory
createEntityManager
in interface OpenJPAEntityManagerFactorySPI
public OpenJPAEntityManagerSPI createEntityManager(Map props)
createEntityManager
in interface EntityManagerFactory
createEntityManager
in interface OpenJPAEntityManagerFactory
createEntityManager
in interface OpenJPAEntityManagerFactorySPI
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()
close
in interface EntityManagerFactory
close
in interface Closeable
public boolean isOpen()
isOpen
in interface EntityManagerFactory
public Cache getCache()
getCache
in interface EntityManagerFactory
public OpenJPACriteriaBuilder getCriteriaBuilder()
OpenJPAEntityManagerFactory
getCriteriaBuilder
in interface 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 EntityManagerFactory
public PersistenceUnitUtil getPersistenceUnitUtil()
getPersistenceUnitUtil
in interface EntityManagerFactory
public Object getIdentifier(Object entity)
getIdentifier
in interface PersistenceUnitUtil
public boolean isLoaded(Object entity)
isLoaded
in interface PersistenceUnitUtil
isLoaded
in interface PersistenceUtil
public boolean isLoaded(Object entity, String attribute)
isLoaded
in interface PersistenceUnitUtil
isLoaded
in interface PersistenceUtil
Copyright © 2006–2017 Apache Software Foundation. All rights reserved.