public class ReloadableEntityManagerFactory extends java.lang.Object implements EntityManagerFactory, java.io.Serializable
Modifier and Type | Class and Description |
---|---|
static class |
ReloadableEntityManagerFactory.JMXReloadableEntityManagerFactory |
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
JAVAX_PERSISTENCE_SHARED_CACHE_MODE |
static java.lang.String |
JAVAX_PERSISTENCE_TRANSACTION_TYPE |
static java.lang.String |
JAVAX_PERSISTENCE_VALIDATION_MODE |
static java.lang.String |
OPENEJB_JPA_CRITERIA_LOG_JPQL |
static java.lang.String |
OPENEJB_JPA_CRITERIA_LOG_JPQL_LEVEL |
Constructor and Description |
---|
ReloadableEntityManagerFactory(java.lang.ClassLoader cl,
EntityManagerFactoryCallable callable,
PersistenceUnitInfoImpl unitInfo) |
Modifier and Type | Method and Description |
---|---|
void |
addJarFileUrls(java.lang.String file) |
void |
addManagedClasses(java.lang.String clazz) |
void |
addMappingFile(java.lang.String file) |
<T> void |
addNamedEntityGraph(java.lang.String graphName,
EntityGraph<T> entityGraph)
Add a named copy of the EntityGraph to the
EntityManagerFactory.
|
void |
addNamedQuery(java.lang.String name,
Query query)
Define the query, typed query, or stored procedure query as
a named query such that future query objects can be created
from it using the
createNamedQuery or
createNamedStoredProcedureQuery method. |
void |
close()
Close the factory, releasing any resources that it holds.
|
void |
createDelegate() |
EntityManager |
createEntityManager()
Create a new application-managed
EntityManager . |
EntityManager |
createEntityManager(java.util.Map map)
Create a new application-managed
EntityManager with the
specified Map of properties. |
EntityManager |
createEntityManager(SynchronizationType synchronizationType)
Create a new JTA application-managed
EntityManager with the
specified synchronization type. |
EntityManager |
createEntityManager(SynchronizationType synchronizationType,
java.util.Map map)
Create a new JTA application-managed
EntityManager with the
specified synchronization type and map of properties. |
Cache |
getCache()
Access the cache that is associated with the entity manager
factory (the "second level cache").
|
CriteriaBuilder |
getCriteriaBuilder()
Return an instance of
CriteriaBuilder for the creation of
CriteriaQuery objects. |
EntityManagerFactory |
getDelegate() |
EntityManagerFactoryCallable |
getEntityManagerFactoryCallable() |
boolean |
getExcludeUnlistedClasses() |
java.util.List<java.net.URL> |
getJarFileUrls() |
java.util.List<java.lang.String> |
getManagedClasses() |
java.util.List<java.lang.String> |
getMappingFiles() |
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.
|
java.util.Map<java.lang.String,java.lang.Object> |
getProperties()
Get the properties and associated values that are in effect
for the entity manager factory.
|
java.util.Properties |
getUnitProperties() |
PersistenceUnitInfo |
info() |
boolean |
isOpen()
Indicates whether the factory is open.
|
void |
overrideClassLoader(java.lang.ClassLoader loader) |
void |
register() |
void |
reload() |
void |
removeJarFileUrls(java.lang.String file) |
void |
removeManagedClasses(java.lang.String clazz) |
void |
removeMappingFile(java.lang.String file) |
void |
removeProperty(java.lang.String key) |
void |
setExcludeUnlistedClasses(boolean excludeUnlistedClasses) |
void |
setProperty(java.lang.String key,
java.lang.String value) |
void |
setProvider(java.lang.String providerRaw) |
void |
setSharedCacheMode(SharedCacheMode mode) |
void |
setTransactionType(PersistenceUnitTransactionType type) |
void |
setValidationMode(ValidationMode mode) |
void |
unregister() |
<T> T |
unwrap(java.lang.Class<T> cls)
Return an object of the specified type to allow access to the
provider-specific API.
|
public static final java.lang.String JAVAX_PERSISTENCE_SHARED_CACHE_MODE
public static final java.lang.String JAVAX_PERSISTENCE_VALIDATION_MODE
public static final java.lang.String JAVAX_PERSISTENCE_TRANSACTION_TYPE
public static final java.lang.String OPENEJB_JPA_CRITERIA_LOG_JPQL
public static final java.lang.String OPENEJB_JPA_CRITERIA_LOG_JPQL_LEVEL
public ReloadableEntityManagerFactory(java.lang.ClassLoader cl, EntityManagerFactoryCallable callable, PersistenceUnitInfoImpl unitInfo)
public void overrideClassLoader(java.lang.ClassLoader loader)
public EntityManagerFactoryCallable getEntityManagerFactoryCallable()
public void createDelegate()
public EntityManager createEntityManager()
EntityManagerFactory
EntityManager
.
This method returns a new EntityManager
instance each time
it is invoked.
The isOpen
method will return true on the returned instance.createEntityManager
in interface EntityManagerFactory
public EntityManager createEntityManager(java.util.Map map)
EntityManagerFactory
EntityManager
with the
specified Map of properties.
This method returns a new EntityManager
instance each time
it is invoked.
The isOpen
method will return true on the returned instance.createEntityManager
in interface EntityManagerFactory
map
- properties for entity managerpublic EntityManager createEntityManager(SynchronizationType synchronizationType)
EntityManagerFactory
EntityManager
with the
specified synchronization type.
This method returns a new EntityManager
instance each time
it is invoked.
The isOpen
method will return true on the returned instance.createEntityManager
in interface EntityManagerFactory
synchronizationType
- how and when the entity manager should be
synchronized with the current JTA transactionpublic EntityManager createEntityManager(SynchronizationType synchronizationType, java.util.Map map)
EntityManagerFactory
EntityManager
with the
specified synchronization type and map of properties.
This method returns a new EntityManager
instance each time
it is invoked.
The isOpen
method will return true on the returned instance.createEntityManager
in interface EntityManagerFactory
synchronizationType
- how and when the entity manager should be
synchronized with the current JTA transactionmap
- properties for entity managerpublic <T> T unwrap(java.lang.Class<T> cls)
EntityManagerFactory
unwrap
in interface EntityManagerFactory
cls
- the class of the object to be returned. This is
normally either the underlying EntityManagerFactory
implementation class or an interface that it implements.public void addNamedQuery(java.lang.String name, Query query)
EntityManagerFactory
createNamedQuery
or
createNamedStoredProcedureQuery
method.
Any configuration of the query object (except for actual parameter binding) in effect when the named query is added is retained as part of the named query definition. This includes configuration information such as max results, hints, flush mode, lock mode, result set mapping information, and information about stored procedure parameters.
When the query is executed, information that can be set
by means of the query APIs can be overridden. Information
that is overridden does not affect the named query as
registered with the entity manager factory, and thus does
not affect subsequent query objects created from it by
means of the createNamedQuery
or
createNamedStoredProcedureQuery
method.
If a named query of the same name has been previously defined, either statically via metadata or via this method, that query definition is replaced.
addNamedQuery
in interface EntityManagerFactory
name
- name for the queryquery
- Query, TypedQuery, or StoredProcedureQuery objectpublic <T> void addNamedEntityGraph(java.lang.String graphName, EntityGraph<T> entityGraph)
EntityManagerFactory
addNamedEntityGraph
in interface EntityManagerFactory
graphName
- name for the entity graphentityGraph
- entity graphpublic CriteriaBuilder getCriteriaBuilder()
EntityManagerFactory
CriteriaBuilder
for the creation of
CriteriaQuery
objects.getCriteriaBuilder
in interface EntityManagerFactory
public Metamodel getMetamodel()
EntityManagerFactory
Metamodel
interface for access to the
metamodel of the persistence unit.getMetamodel
in interface EntityManagerFactory
public boolean isOpen()
EntityManagerFactory
isOpen
in interface EntityManagerFactory
public void close()
EntityManagerFactory
IllegalStateException
, except
for isOpen
, which will return false. Once an
EntityManagerFactory
has been closed, all its
entity managers are considered to be in the closed state.close
in interface EntityManagerFactory
public java.util.Map<java.lang.String,java.lang.Object> getProperties()
EntityManagerFactory
getProperties
in interface EntityManagerFactory
public Cache getCache()
EntityManagerFactory
getCache
in interface EntityManagerFactory
Cache
interface or null if
no cache is in usepublic PersistenceUnitUtil getPersistenceUnitUtil()
EntityManagerFactory
getPersistenceUnitUtil
in interface EntityManagerFactory
PersistenceUnitUtil
interfacepublic EntityManagerFactory getDelegate()
public void register() throws OpenEJBException
OpenEJBException
public void unregister() throws OpenEJBException
OpenEJBException
public void reload()
public void setSharedCacheMode(SharedCacheMode mode)
public void setValidationMode(ValidationMode mode)
public void setProvider(java.lang.String providerRaw)
public void setTransactionType(PersistenceUnitTransactionType type)
public void setProperty(java.lang.String key, java.lang.String value)
public void removeProperty(java.lang.String key)
public java.util.Properties getUnitProperties()
public java.util.List<java.lang.String> getMappingFiles()
public void addMappingFile(java.lang.String file)
public void removeMappingFile(java.lang.String file)
public java.util.List<java.net.URL> getJarFileUrls()
public void addJarFileUrls(java.lang.String file)
public void removeJarFileUrls(java.lang.String file)
public java.util.List<java.lang.String> getManagedClasses()
public void addManagedClasses(java.lang.String clazz)
public void removeManagedClasses(java.lang.String clazz)
public PersistenceUnitInfo info()
public void setExcludeUnlistedClasses(boolean excludeUnlistedClasses)
public boolean getExcludeUnlistedClasses()