Package org.apache.openjpa.persistence
Class EntityManagerFactoryImpl
java.lang.Object
org.apache.openjpa.persistence.EntityManagerFactoryImpl
- All Implemented Interfaces:
jakarta.persistence.EntityManagerFactory,jakarta.persistence.PersistenceUnitUtil,jakarta.persistence.PersistenceUtil,Serializable,Closeable,OpenJPAEntityManagerFactory,OpenJPAEntityManagerFactorySPI
public class EntityManagerFactoryImpl
extends Object
implements OpenJPAEntityManagerFactory, OpenJPAEntityManagerFactorySPI, Closeable, jakarta.persistence.PersistenceUnitUtil
Implementation of
EntityManagerFactory that acts as a
facade to a BrokerFactory.- Author:
- Marc Prud'hommeaux
- See Also:
-
Field Summary
Fields inherited from interface org.apache.openjpa.persistence.OpenJPAEntityManagerFactory
CONN_RETAIN_ALWAYS, CONN_RETAIN_DEMAND, CONN_RETAIN_TRANS -
Constructor Summary
ConstructorsConstructorDescriptionDefault constructor provided for auto-instantiation.EntityManagerFactoryImpl(BrokerFactory factory) Supply delegate on construction. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddLifecycleListener(Object listener, Class... classes) Register a listener for lifecycle-related events on the specified classes.<T> voidaddNamedEntityGraph(String graphName, jakarta.persistence.EntityGraph<T> entityGraph) voidaddNamedQuery(String name, jakarta.persistence.Query query) voidaddTransactionListener(Object listener) Register a listener for transaction-related events on the specified classes.voidclose()createEntityManager(jakarta.persistence.SynchronizationType synchronizationType) createEntityManager(jakarta.persistence.SynchronizationType synchronizationType, Map props) Creates and configures a entity manager with the given properties.createEntityManager(Map props) Return an entity manager with the provided additional configuration settings.booleanDelegate.jakarta.persistence.CachegetCache()Return the configuration for this factory.Gets the QueryBuilder with OpenJPA-extended capabilities.Gets a builder for dynamic queries.getIdentifier(Object entity) Get the identifier for the specified entity.jakarta.persistence.PersistenceUnitUtilReturn properties describing this runtime.Access query result cache.Access the level 2 store cache.getStoreCache(String cacheName) Access a named level 2 store cache.Get the properties supported by this runtime.getUserObject(Object key) Get the value for the specified key from the map of user objects.inthashCode()booleanbooleanbooleanisOpen()protected EntityManagerImplnewEntityManagerImpl(Broker broker) Create a new entity manager around the given broker.putUserObject(Object key, Object val) Put the specified key-value pair into the map of user objects.voidremoveLifecycleListener(Object listener) Remove a listener for lifecycle-related events.voidremoveTransactionListener(Object listener) Remove a listener for transaction-related events.voidsetBrokerFactory(BrokerFactory factory) Delegate must be provided before use.<T> T
-
Constructor Details
-
EntityManagerFactoryImpl
public EntityManagerFactoryImpl()Default constructor provided for auto-instantiation. -
EntityManagerFactoryImpl
Supply delegate on construction.
-
-
Method Details
-
getBrokerFactory
Delegate. -
setBrokerFactory
Delegate must be provided before use. -
getConfiguration
Description copied from interface:OpenJPAEntityManagerFactorySPIReturn the configuration for this factory.- Specified by:
getConfigurationin interfaceOpenJPAEntityManagerFactory- Specified by:
getConfigurationin interfaceOpenJPAEntityManagerFactorySPI
-
getProperties
Description copied from interface:OpenJPAEntityManagerFactoryReturn properties describing this runtime.- Specified by:
getPropertiesin interfacejakarta.persistence.EntityManagerFactory- Specified by:
getPropertiesin interfaceOpenJPAEntityManagerFactory
-
putUserObject
Description copied from interface:OpenJPAEntityManagerFactoryPut the specified key-value pair into the map of user objects.- Specified by:
putUserObjectin interfaceOpenJPAEntityManagerFactory
-
getUserObject
Description copied from interface:OpenJPAEntityManagerFactoryGet the value for the specified key from the map of user objects.- Specified by:
getUserObjectin interfaceOpenJPAEntityManagerFactory
-
getStoreCache
Description copied from interface:OpenJPAEntityManagerFactoryAccess the level 2 store cache. This cache acts as a proxy to all named caches.- Specified by:
getStoreCachein interfaceOpenJPAEntityManagerFactory
-
getStoreCache
Description copied from interface:OpenJPAEntityManagerFactoryAccess a named level 2 store cache.- Specified by:
getStoreCachein interfaceOpenJPAEntityManagerFactory
-
getQueryResultCache
Description copied from interface:OpenJPAEntityManagerFactoryAccess query result cache.- Specified by:
getQueryResultCachein interfaceOpenJPAEntityManagerFactory
-
createEntityManager
- Specified by:
createEntityManagerin interfacejakarta.persistence.EntityManagerFactory- Specified by:
createEntityManagerin interfaceOpenJPAEntityManagerFactory- Specified by:
createEntityManagerin interfaceOpenJPAEntityManagerFactorySPI
-
createEntityManager
public OpenJPAEntityManagerSPI createEntityManager(jakarta.persistence.SynchronizationType synchronizationType) - Specified by:
createEntityManagerin interfacejakarta.persistence.EntityManagerFactory
-
createEntityManager
Description copied from interface:OpenJPAEntityManagerFactoryReturn an entity manager with the provided additional configuration settings. OpenJPA recognizes the following configuration settings in this method:- openjpa.ConnectionUsername
- openjpa.ConnectionPassword
- openjpa.ConnectionRetainMode
- openjpa.TransactionMode
- Specified by:
createEntityManagerin interfacejakarta.persistence.EntityManagerFactory- Specified by:
createEntityManagerin interfaceOpenJPAEntityManagerFactory- Specified by:
createEntityManagerin interfaceOpenJPAEntityManagerFactorySPI
-
createEntityManager
public OpenJPAEntityManagerSPI createEntityManager(jakarta.persistence.SynchronizationType synchronizationType, Map props) Creates and configures a entity manager with the given properties. The property keys in the given map can be either qualified or not.- Specified by:
createEntityManagerin interfacejakarta.persistence.EntityManagerFactory- Returns:
- list of exceptions raised or empty list.
-
newEntityManagerImpl
Create a new entity manager around the given broker. -
addLifecycleListener
Description copied from interface:OpenJPAEntityManagerFactorySPIRegister a listener for lifecycle-related events on the specified classes. If the classes are null, all events will be propagated to the listener. The listener will be passed on to all new entity managers. See theorg.apache.openjpa.eventpackage for listener types.- Specified by:
addLifecycleListenerin interfaceOpenJPAEntityManagerFactory- Specified by:
addLifecycleListenerin interfaceOpenJPAEntityManagerFactorySPI
-
removeLifecycleListener
Description copied from interface:OpenJPAEntityManagerFactorySPIRemove a listener for lifecycle-related events.- Specified by:
removeLifecycleListenerin interfaceOpenJPAEntityManagerFactory- Specified by:
removeLifecycleListenerin interfaceOpenJPAEntityManagerFactorySPI
-
addTransactionListener
Description copied from interface:OpenJPAEntityManagerFactorySPIRegister a listener for transaction-related events on the specified classes. The listener will be passed on to all new entity managers. See theorg.apache.openjpa.eventpackage for listener types.- Specified by:
addTransactionListenerin interfaceOpenJPAEntityManagerFactory- Specified by:
addTransactionListenerin interfaceOpenJPAEntityManagerFactorySPI
-
removeTransactionListener
Description copied from interface:OpenJPAEntityManagerFactorySPIRemove a listener for transaction-related events.- Specified by:
removeTransactionListenerin interfaceOpenJPAEntityManagerFactory- Specified by:
removeTransactionListenerin interfaceOpenJPAEntityManagerFactorySPI
-
close
public void close() -
isOpen
public boolean isOpen()- Specified by:
isOpenin interfacejakarta.persistence.EntityManagerFactory
-
hashCode
public int hashCode() -
equals
-
getCache
public jakarta.persistence.Cache getCache()- Specified by:
getCachein interfacejakarta.persistence.EntityManagerFactory
-
getCriteriaBuilder
Description copied from interface:OpenJPAEntityManagerFactoryGets the QueryBuilder with OpenJPA-extended capabilities.- Specified by:
getCriteriaBuilderin interfacejakarta.persistence.EntityManagerFactory- Specified by:
getCriteriaBuilderin interfaceOpenJPAEntityManagerFactory
-
getDynamicQueryBuilder
Description copied from interface:OpenJPAEntityManagerFactoryGets a builder for dynamic queries.- Specified by:
getDynamicQueryBuilderin interfaceOpenJPAEntityManagerFactory
-
getSupportedProperties
Description copied from interface:OpenJPAEntityManagerFactoryGet the properties supported by this runtime.- Specified by:
getSupportedPropertiesin interfaceOpenJPAEntityManagerFactory
-
getMetamodel
- Specified by:
getMetamodelin interfacejakarta.persistence.EntityManagerFactory
-
getPersistenceUnitUtil
public jakarta.persistence.PersistenceUnitUtil getPersistenceUnitUtil()- Specified by:
getPersistenceUnitUtilin interfacejakarta.persistence.EntityManagerFactory
-
addNamedQuery
- Specified by:
addNamedQueryin interfacejakarta.persistence.EntityManagerFactory
-
unwrap
- Specified by:
unwrapin interfacejakarta.persistence.EntityManagerFactory
-
addNamedEntityGraph
public <T> void addNamedEntityGraph(String graphName, jakarta.persistence.EntityGraph<T> entityGraph) - Specified by:
addNamedEntityGraphin interfacejakarta.persistence.EntityManagerFactory
-
getIdentifier
Get the identifier for the specified entity. If not managed by any of the em's in this PU or not persistence capable, return null.- Specified by:
getIdentifierin interfacejakarta.persistence.PersistenceUnitUtil
-
isLoaded
- Specified by:
isLoadedin interfacejakarta.persistence.PersistenceUnitUtil- Specified by:
isLoadedin interfacejakarta.persistence.PersistenceUtil
-
isLoaded
- Specified by:
isLoadedin interfacejakarta.persistence.PersistenceUnitUtil- Specified by:
isLoadedin interfacejakarta.persistence.PersistenceUtil
-