public class JPAEntityManagerFactory extends Object implements javax.persistence.EntityManagerFactory, javax.persistence.PersistenceUnitUtil, JPAEntityGraphRegistrationListener, Serializable
| Modifier and Type | Field and Description |
|---|---|
static org.datanucleus.util.NucleusLogger |
LOGGER
Logger for enhancing.
|
| Constructor and Description |
|---|
JPAEntityManagerFactory(javax.persistence.spi.PersistenceUnitInfo unitInfo,
Map overridingProps)
Constructor when working in a JavaEE environment.
|
JPAEntityManagerFactory(org.datanucleus.metadata.PersistenceUnitMetaData pumd,
Map overridingProps)
Convenience constructor to allow for dynamic persistence-unit creation in JavaSE.
|
JPAEntityManagerFactory(String unitName,
Map overridingProps)
Constructor when working in a JavaSE environment.
|
| Modifier and Type | Method and Description |
|---|---|
<T> void |
addNamedEntityGraph(String graphName,
javax.persistence.EntityGraph<T> graph) |
void |
addNamedQuery(String name,
javax.persistence.Query query) |
protected void |
assertIsClosed() |
void |
close()
Method to close the factory.
|
javax.persistence.EntityManager |
createEntityManager()
Method to create an (application-managed) entity manager.
|
javax.persistence.EntityManager |
createEntityManager(Map overridingProps)
Method to create an (application-managed) entity manager with the specified properties.
|
javax.persistence.EntityManager |
createEntityManager(javax.persistence.SynchronizationType syncType)
Create a new JTA application-managed EntityManager with the specified synchronization type.
|
javax.persistence.EntityManager |
createEntityManager(javax.persistence.SynchronizationType syncType,
Map overridingProps)
Create a new JTA application-managed EntityManager with the specified synchronization type
and Map of properties.
|
void |
deregisterEntityGraph(String graphName) |
void |
entityGraphRegistered(JPAEntityGraph eg) |
javax.persistence.Cache |
getCache()
Accessor for the second level cache.
|
javax.persistence.criteria.CriteriaBuilder |
getCriteriaBuilder() |
String |
getDefinedEntityGraphName() |
Set<String> |
getEntityGraphNames() |
<T> List<javax.persistence.EntityGraph<? super T>> |
getEntityGraphsByType(Class<T> entityClass) |
Object |
getIdentifier(Object entity) |
javax.persistence.metamodel.Metamodel |
getMetamodel() |
String |
getName() |
javax.persistence.EntityGraph |
getNamedEntityGraph(String graphName) |
org.datanucleus.NucleusContext |
getNucleusContext() |
javax.persistence.PersistenceUnitUtil |
getPersistenceUnitUtil() |
Map<String,Object> |
getProperties()
Get the properties and associated values that are in effect for the entity manager factory.
|
JPAQueryCache |
getQueryCache()
Accessor for the query results cache.
|
org.datanucleus.store.query.cache.QueryDatastoreCompilationCache |
getQueryDatastoreCompilationCache()
Accessor for the query datastore compilation cache.
|
org.datanucleus.query.cache.QueryCompilationCache |
getQueryGenericCompilationCache()
Accessor for the query generic compilation cache.
|
Set<String> |
getSupportedProperties()
Get the names of the properties that are supported for use with the entity manager factory.
|
protected org.datanucleus.PersistenceNucleusContext |
initialiseNucleusContext(org.datanucleus.metadata.PersistenceUnitMetaData unitMetaData,
Map overridingProps,
org.datanucleus.plugin.PluginManager pluginMgr)
Method to initialise a PersistenceManagerFactory that will control the persistence.
|
boolean |
isContainerManaged()
Accessor for whether the EMF is managed by a container.
|
boolean |
isLoaded(Object entity) |
boolean |
isLoaded(Object entity,
String attrName) |
boolean |
isOpen()
Accessor for whether the factory is open
|
protected javax.persistence.EntityManager |
newEntityManager(org.datanucleus.PersistenceNucleusContext nucleusCtx,
javax.persistence.PersistenceContextType contextType,
javax.persistence.SynchronizationType syncType)
Creates an
EntityManager. |
void |
registerEntityGraph(JPAEntityGraph eg,
String graphName) |
<T> T |
unwrap(Class<T> cls)
Return an object of the specified type to allow access to the provider-specific API.
|
public static final org.datanucleus.util.NucleusLogger LOGGER
public JPAEntityManagerFactory(javax.persistence.spi.PersistenceUnitInfo unitInfo,
Map overridingProps)
unitInfo - The "persistent-unit" infooverridingProps - factory properties overriding those in the "persistence-unit"public JPAEntityManagerFactory(org.datanucleus.metadata.PersistenceUnitMetaData pumd,
Map overridingProps)
pumd - Persistence unit metadataoverridingProps - Properties overriding those defined for this unitpublic org.datanucleus.NucleusContext getNucleusContext()
public boolean isContainerManaged()
public String getName()
public void close()
close in interface javax.persistence.EntityManagerFactorypublic boolean isOpen()
isOpen in interface javax.persistence.EntityManagerFactorypublic JPAQueryCache getQueryCache()
public org.datanucleus.query.cache.QueryCompilationCache getQueryGenericCompilationCache()
public org.datanucleus.store.query.cache.QueryDatastoreCompilationCache getQueryDatastoreCompilationCache()
public void addNamedQuery(String name, javax.persistence.Query query)
addNamedQuery in interface javax.persistence.EntityManagerFactorypublic javax.persistence.EntityManager createEntityManager()
createEntityManager in interface javax.persistence.EntityManagerFactorypublic javax.persistence.EntityManager createEntityManager(Map overridingProps)
createEntityManager in interface javax.persistence.EntityManagerFactoryoverridingProps - Properties to use for this managerpublic javax.persistence.EntityManager createEntityManager(javax.persistence.SynchronizationType syncType)
createEntityManager in interface javax.persistence.EntityManagerFactorysyncType - how and when the entity manager should be synchronized with the current JTA transactionIllegalStateException - if the entity manager factory has been configured for
resource-local entity managers or has been closedpublic javax.persistence.EntityManager createEntityManager(javax.persistence.SynchronizationType syncType,
Map overridingProps)
createEntityManager in interface javax.persistence.EntityManagerFactorysyncType - how and when the entity manager should be synchronized with the current JTA transactionoverridingProps - properties for entity manager; may be nullIllegalStateException - if the entity manager factory has been configured for resource-local
entity managers or has been closedprotected javax.persistence.EntityManager newEntityManager(org.datanucleus.PersistenceNucleusContext nucleusCtx,
javax.persistence.PersistenceContextType contextType,
javax.persistence.SynchronizationType syncType)
EntityManager.
Override if you want to return a different type that implements this interface.nucleusCtx - Nucleus ContextcontextType - The persistence context typesyncType - Synchronization typeprotected org.datanucleus.PersistenceNucleusContext initialiseNucleusContext(org.datanucleus.metadata.PersistenceUnitMetaData unitMetaData,
Map overridingProps,
org.datanucleus.plugin.PluginManager pluginMgr)
unitMetaData - The "persistence-unit" metadata (if any)overridingProps - Properties to override all otherspluginMgr - Plugin Managerpublic Map<String,Object> getProperties()
getProperties in interface javax.persistence.EntityManagerFactorypublic Set<String> getSupportedProperties()
protected void assertIsClosed()
public javax.persistence.Cache getCache()
getCache in interface javax.persistence.EntityManagerFactorypublic javax.persistence.metamodel.Metamodel getMetamodel()
getMetamodel in interface javax.persistence.EntityManagerFactorypublic javax.persistence.criteria.CriteriaBuilder getCriteriaBuilder()
getCriteriaBuilder in interface javax.persistence.EntityManagerFactorypublic javax.persistence.PersistenceUnitUtil getPersistenceUnitUtil()
getPersistenceUnitUtil in interface javax.persistence.EntityManagerFactorypublic Object getIdentifier(Object entity)
getIdentifier in interface javax.persistence.PersistenceUnitUtilpublic boolean isLoaded(Object entity, String attrName)
isLoaded in interface javax.persistence.PersistenceUnitUtilisLoaded in interface javax.persistence.PersistenceUtilpublic boolean isLoaded(Object entity)
isLoaded in interface javax.persistence.PersistenceUnitUtilisLoaded in interface javax.persistence.PersistenceUtilpublic <T> T unwrap(Class<T> cls)
unwrap in interface javax.persistence.EntityManagerFactorycls - the class of the object to be returned. This is normally either the underlying
EntityManagerFactory implementation class or an interface that it implements.javax.persistence.PersistenceException - if the provider does not support the call.public javax.persistence.EntityGraph getNamedEntityGraph(String graphName)
public <T> List<javax.persistence.EntityGraph<? super T>> getEntityGraphsByType(Class<T> entityClass)
public <T> void addNamedEntityGraph(String graphName, javax.persistence.EntityGraph<T> graph)
addNamedEntityGraph in interface javax.persistence.EntityManagerFactorypublic void registerEntityGraph(JPAEntityGraph eg, String graphName)
public void deregisterEntityGraph(String graphName)
public String getDefinedEntityGraphName()
public void entityGraphRegistered(JPAEntityGraph eg)
entityGraphRegistered in interface JPAEntityGraphRegistrationListenerCopyright © 2015. All rights reserved.