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
EntityGraphs 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()
EntityManagerFactoryEntityManager. 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 EntityManagerFactorypublic EntityManager createEntityManager(SynchronizationType synchronizationType)
EntityManagerFactorycreateEntityManager in interface EntityManagerFactorysynchronizationType - how and when the entity manager should be synchronized with the current JTA
transactionpublic EntityManager createEntityManager(Map map)
EntityManagerFactoryEntityManager 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 EntityManagerFactorymap - properties for entity managerpublic EntityManager createEntityManager(SynchronizationType synchronizationType, Map map)
EntityManagerFactorycreateEntityManager in interface EntityManagerFactorysynchronizationType - how and when the entity manager
should be synchronized with the current JTA transactionmap - properties for entity manager; may be nullpublic CriteriaBuilder getCriteriaBuilder()
EntityManagerFactoryCriteriaBuilder for the creation of
CriteriaQuery objects.getCriteriaBuilder in interface EntityManagerFactorypublic Metamodel getMetamodel()
EntityManagerFactoryMetamodel interface for access to the
metamodel of the persistence unit.getMetamodel in interface EntityManagerFactorypublic void close()
EntityManagerFactoryIllegalStateException, 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 EntityManagerFactorypublic Map<String,Object> getProperties()
EntityManagerFactorygetProperties in interface EntityManagerFactorypublic Cache getCache()
EntityManagerFactorygetCache in interface EntityManagerFactoryCache interfaceprotected void validateNotClosed()
public PersistenceUnitUtil getPersistenceUnitUtil()
EntityManagerFactorygetPersistenceUnitUtil in interface EntityManagerFactoryPersistenceUnitUtil interfacepublic void addNamedQuery(String name, Query query)
EntityManagerFactoryaddNamedQuery in interface EntityManagerFactoryname - name for the queryquery - Query, TypedQuery, or StoredProcedureQuery objectpublic <T> T unwrap(Class<T> type)
EntityManagerFactoryunwrap in interface EntityManagerFactorytype - 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)
EntityManagerFactoryaddNamedEntityGraph in interface EntityManagerFactorygraphName - name for the entity graphentityGraph - entity graphpublic EntityGraphImpl findEntityGraphByName(String name)
public <T> List<EntityGraph<? super T>> findEntityGraphsByType(Class<T> entityClass)
HibernateEntityManagerFactoryEntityGraphs associated with a given entity type.findEntityGraphsByType in interface HibernateEntityManagerFactoryentityClass - the entity type for which to find all EntityGraphs.EntityGraph instances associated with the given entity type. The empty list is
returned in case there are not entity graphs.public boolean isOpen()
EntityManagerFactoryisOpen in interface EntityManagerFactorypublic SessionFactoryImplementor getSessionFactory()
HibernateEntityManagerFactorygetSessionFactory in interface HibernateEntityManagerFactorypublic EntityType getEntityTypeByName(String entityName)
HibernateEntityManagerFactorygetEntityTypeByName in interface HibernateEntityManagerFactoryentityName - entity nameEntityType for the specified namepublic String getEntityManagerFactoryName()
HibernateEntityManagerFactorygetEntityManagerFactoryName in interface HibernateEntityManagerFactoryCopyright © 2018 JBoss by Red Hat. All rights reserved.