public class EntityManagerFactoryImpl extends Object implements HibernateEntityManagerFactory
EntityManagerFactory
.Constructor and Description |
---|
EntityManagerFactoryImpl(String persistenceUnitName,
SessionFactoryImplementor sessionFactory,
MetadataImplementor metadata,
SettingsImpl settings,
Map<?,?> configurationValues) |
Modifier and Type | Method and Description |
---|---|
<T> void |
addNamedEntityGraph(String graphName,
EntityGraph<T> entityGraph)
Add a named copy of the EntityGraph to the
EntityManagerFactory.
|
void |
addNamedQuery(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 methods.
|
void |
close()
Close the factory, releasing any resources that it holds.
|
EntityManager |
createEntityManager()
Create a new application-managed
EntityManager . |
EntityManager |
createEntityManager(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,
Map map)
Create a new JTA application-managed EntityManager with the specified synchronization type and Map of properties.
|
protected org.hibernate.jpa.internal.EntityManagerFactoryImpl.JpaMetaModelPopulationSetting |
determineJpaMetaModelPopulationSetting(Map configurationValues) |
EntityGraphImpl |
findEntityGraphByName(String name) |
<T> List<EntityGraph<? super T>> |
findEntityGraphsByType(Class<T> entityClass)
Find all
EntityGraph s associated with a given entity type. |
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. |
String |
getEntityManagerFactoryName()
Returns the name of the factory.
|
EntityType |
getEntityTypeByName(String entityName)
Find an entity type by name
|
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.
|
Map<String,Object> |
getProperties()
Get the properties and associated values that are in effect
for the entity manager factory.
|
SessionFactoryImplementor |
getSessionFactory()
Obtain the underlying Hibernate SessionFactory.
|
boolean |
isOpen()
Indicates whether the factory is open.
|
<T> T |
unwrap(Class<T> type)
Return an object of the specified type to allow access to the
provider-specific API.
|
protected void |
validateNotClosed() |
public EntityManagerFactoryImpl(String persistenceUnitName, SessionFactoryImplementor sessionFactory, MetadataImplementor metadata, SettingsImpl settings, Map<?,?> configurationValues)
protected org.hibernate.jpa.internal.EntityManagerFactoryImpl.JpaMetaModelPopulationSetting determineJpaMetaModelPopulationSetting(Map configurationValues)
public EntityManager createEntityManager()
EntityManagerFactory
EntityManager
. This method returns a new
code>EntityManager instance each time it is invoked. The isOpen
method will return true
on the returned instance.createEntityManager
in interface EntityManagerFactory
public EntityManager createEntityManager(SynchronizationType synchronizationType)
EntityManagerFactory
createEntityManager
in interface EntityManagerFactory
synchronizationType
- how and when the entity manager should be synchronized with the current JTA
transactionpublic EntityManager createEntityManager(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, Map map)
EntityManagerFactory
createEntityManager
in interface EntityManagerFactory
synchronizationType
- how and when the entity manager
should be synchronized with the current JTA transactionmap
- properties for entity manager; may be nullpublic 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 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 Map<String,Object> getProperties()
EntityManagerFactory
getProperties
in interface EntityManagerFactory
public Cache getCache()
EntityManagerFactory
getCache
in interface EntityManagerFactory
Cache
interfaceprotected void validateNotClosed()
public PersistenceUnitUtil getPersistenceUnitUtil()
EntityManagerFactory
getPersistenceUnitUtil
in interface EntityManagerFactory
PersistenceUnitUtil
interfacepublic void addNamedQuery(String name, Query query)
EntityManagerFactory
addNamedQuery
in interface EntityManagerFactory
name
- name for the queryquery
- Query, TypedQuery, or StoredProcedureQuery objectpublic <T> T unwrap(Class<T> type)
EntityManagerFactory
unwrap
in interface EntityManagerFactory
type
- the class of the object to be returned. This is
normally either the underlying EntityManagerFactory
implementation class or an interface that it implements.public <T> void addNamedEntityGraph(String graphName, EntityGraph<T> entityGraph)
EntityManagerFactory
addNamedEntityGraph
in interface EntityManagerFactory
graphName
- name for the entity graphentityGraph
- entity graphpublic EntityGraphImpl findEntityGraphByName(String name)
public <T> List<EntityGraph<? super T>> findEntityGraphsByType(Class<T> entityClass)
HibernateEntityManagerFactory
EntityGraph
s associated with a given entity type.findEntityGraphsByType
in interface HibernateEntityManagerFactory
entityClass
- the entity type for which to find all EntityGraph
s.EntityGraph
instances associated with the given entity type. The empty list is
returned in case there are not entity graphs.public boolean isOpen()
EntityManagerFactory
isOpen
in interface EntityManagerFactory
public SessionFactoryImplementor getSessionFactory()
HibernateEntityManagerFactory
getSessionFactory
in interface HibernateEntityManagerFactory
public EntityType getEntityTypeByName(String entityName)
HibernateEntityManagerFactory
getEntityTypeByName
in interface HibernateEntityManagerFactory
entityName
- entity nameEntityType
for the specified namepublic String getEntityManagerFactoryName()
HibernateEntityManagerFactory
getEntityManagerFactoryName
in interface HibernateEntityManagerFactory
Copyright © 2016 JBoss by Red Hat. All rights reserved.