public class SessionFactoryDelegatingImpl extends Object implements SessionFactoryImplementor, SessionFactory
SessionFactoryImplementor.DeserializationResolver<T extends SessionFactoryImplementor>| Constructor and Description |
|---|
SessionFactoryDelegatingImpl(SessionFactoryImplementor delegate) |
| 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 or
createNamedStoredProcedureQuery method. |
void |
addObserver(SessionFactoryObserver observer) |
void |
close()
Destroy this SessionFactory and release all resources (caches,
connection pools, etc).
|
boolean |
containsFetchProfileDefinition(String name)
Determine if this session factory contains a fetch profile definition
registered under the given name.
|
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 SessionFactoryImplementor |
delegate() |
EntityGraph |
findEntityGraphByName(String name) |
<T> List<EntityGraph<? super T>> |
findEntityGraphsByType(Class<T> entityClass)
Find all
EntityGraphs associated with a given entity type. |
Map<String,ClassMetadata> |
getAllClassMetadata()
Retrieve the
ClassMetadata for all mapped entities. |
Map |
getAllCollectionMetadata()
Get the
CollectionMetadata for all mapped collections. |
CacheImplementor |
getCache()
Obtain direct access to the underlying cache regions.
|
ClassMetadata |
getClassMetadata(Class entityClass)
Retrieve the
ClassMetadata associated with the given entity class. |
ClassMetadata |
getClassMetadata(String entityName)
Retrieve the
ClassMetadata associated with the given entity class. |
CollectionMetadata |
getCollectionMetadata(String roleName)
Get the
CollectionMetadata associated with the named collection role. |
CollectionPersister |
getCollectionPersister(String role) |
Map<String,CollectionPersister> |
getCollectionPersisters() |
Set<String> |
getCollectionRolesByEntityParticipant(String entityName) |
CriteriaBuilder |
getCriteriaBuilder()
Return an instance of
CriteriaBuilder for the creation of
CriteriaQuery objects. |
Session |
getCurrentSession()
Obtains the current session.
|
CurrentTenantIdentifierResolver |
getCurrentTenantIdentifierResolver() |
CustomEntityDirtinessStrategy |
getCustomEntityDirtinessStrategy() |
Set |
getDefinedFilterNames()
Obtain a set of the names of all filters defined on this SessionFactory.
|
SessionFactoryImplementor.DeserializationResolver |
getDeserializationResolver() |
Dialect |
getDialect()
Get the SQL dialect.
|
EntityNotFoundDelegate |
getEntityNotFoundDelegate() |
EntityPersister |
getEntityPersister(String entityName) |
Map<String,EntityPersister> |
getEntityPersisters() |
FetchProfile |
getFetchProfile(String name)
Retrieve fetch profile by name.
|
FilterDefinition |
getFilterDefinition(String filterName)
Obtain the definition of a filter by name.
|
IdentifierGenerator |
getIdentifierGenerator(String rootEntityName)
Get the identifier generator for the hierarchy
|
IdentifierGeneratorFactory |
getIdentifierGeneratorFactory()
Allow access to the id generator factory, though this is only needed/allowed from configuration.
|
String |
getIdentifierPropertyName(String className) |
Type |
getIdentifierType(String className) |
String[] |
getImplementors(String className)
Get the names of all persistent classes that implement/extend the given interface/class
|
String |
getImportedClassName(String name)
Get a class name, using query language imports
|
Interceptor |
getInterceptor()
Get the factory scoped interceptor for this factory.
|
JdbcServices |
getJdbcServices()
Get the JdbcServices.
|
MetamodelImplementor |
getMetamodel()
Return an instance of
Metamodel interface for access to the
metamodel of the persistence unit. |
String |
getName()
Access to the name (if one) assigned to the SessionFactory
|
NamedQueryDefinition |
getNamedQuery(String queryName) |
NamedQueryRepository |
getNamedQueryRepository()
Provides access to the named query repository
|
NamedSQLQueryDefinition |
getNamedSQLQuery(String queryName) |
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.
|
QueryPlanCache |
getQueryPlanCache()
Access to the cachres of HQL/JPQL and native query plans.
|
Reference |
getReference() |
Type |
getReferencedPropertyType(String className,
String propertyName) |
ResultSetMappingDefinition |
getResultSetMapping(String name) |
String[] |
getReturnAliases(String queryString)
Get the return aliases of a query
|
Type[] |
getReturnTypes(String queryString)
Get the return types of a query
|
ServiceRegistryImplementor |
getServiceRegistry()
Access to the ServiceRegistry for this SessionFactory.
|
SessionFactoryOptions |
getSessionFactoryOptions()
Get the special options used to build the factory.
|
Settings |
getSettings() |
SQLExceptionConverter |
getSQLExceptionConverter()
Retrieves the SQLExceptionConverter in effect for this SessionFactory.
|
SqlExceptionHelper |
getSQLExceptionHelper()
Retrieves the SqlExceptionHelper in effect for this SessionFactory.
|
SQLFunctionRegistry |
getSqlFunctionRegistry() |
StatisticsImplementor |
getStatistics()
Retrieve the statistics fopr this factory.
|
StatisticsImplementor |
getStatisticsImplementor() |
TypeHelper |
getTypeHelper()
Retrieve this factory's
TypeHelper. |
TypeResolver |
getTypeResolver()
Deprecated.
(since 5.3) No replacement, access to and handling of Types will be much different in 6.0
|
String |
getUuid()
Get the UUID for this SessionFactory.
|
boolean |
isClosed()
Is this factory already closed?
|
boolean |
isOpen()
Indicates whether the factory is open.
|
Iterable<EntityNameResolver> |
iterateEntityNameResolvers() |
EntityPersister |
locateEntityPersister(Class byClass) |
EntityPersister |
locateEntityPersister(String byName) |
Session |
openSession()
Open a
Session. |
StatelessSession |
openStatelessSession()
Open a new stateless session.
|
StatelessSession |
openStatelessSession(Connection connection)
Open a new stateless session, utilizing the specified JDBC
Connection. |
Session |
openTemporarySession()
Get a non-transactional "current" session (used by hibernate-envers)
|
void |
registerNamedQueryDefinition(String name,
NamedQueryDefinition definition) |
void |
registerNamedSQLQueryDefinition(String name,
NamedSQLQueryDefinition definition) |
Type |
resolveParameterBindType(Class clazz) |
Type |
resolveParameterBindType(Object bindValue) |
<T> T |
unwrap(Class<T> cls)
Return an object of the specified type to allow access to the
provider-specific API.
|
SessionBuilderImplementor |
withOptions()
Obtain a
Session builder. |
StatelessSessionBuilder |
withStatelessOptions()
Obtain a
StatelessSession builder. |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetEntityManagerFactoryName, getEntityTypeByName, getSessionFactorypublic SessionFactoryDelegatingImpl(SessionFactoryImplementor delegate)
protected SessionFactoryImplementor delegate()
public SessionFactoryOptions getSessionFactoryOptions()
SessionFactorygetSessionFactoryOptions in interface SessionFactorypublic SessionBuilderImplementor withOptions()
SessionFactorySession builder.withOptions in interface SessionFactoryImplementorwithOptions in interface SessionFactorypublic Session openSession() throws HibernateException
SessionFactorySession.
JDBC connection(s will be obtained from the
configured ConnectionProvider as needed
to perform requested work.openSession in interface SessionFactoryHibernateException - Indicates a problem opening the session; pretty rare here.public Session getCurrentSession() throws HibernateException
SessionFactoryCurrentSessionContext impl configured
for use.
Note that for backwards compatibility, if a CurrentSessionContext
is not configured but JTA is configured this will default to the JTASessionContext
impl.getCurrentSession in interface SessionFactoryHibernateException - Indicates an issue locating a suitable current session.public StatelessSessionBuilder withStatelessOptions()
SessionFactoryStatelessSession builder.withStatelessOptions in interface SessionFactorypublic StatelessSession openStatelessSession()
SessionFactoryopenStatelessSession in interface SessionFactorypublic StatelessSession openStatelessSession(Connection connection)
SessionFactoryConnection.openStatelessSession in interface SessionFactoryconnection - Connection provided by the application.public ClassMetadata getClassMetadata(Class entityClass)
SessionFactoryClassMetadata associated with the given entity class.getClassMetadata in interface SessionFactoryentityClass - The entity classpublic ClassMetadata getClassMetadata(String entityName)
SessionFactoryClassMetadata associated with the given entity class.getClassMetadata in interface SessionFactoryentityName - The entity classpublic CollectionMetadata getCollectionMetadata(String roleName)
SessionFactoryCollectionMetadata associated with the named collection role.getCollectionMetadata in interface SessionFactoryroleName - The collection role (in form [owning-entity-name].[collection-property-name]).public Map<String,ClassMetadata> getAllClassMetadata()
SessionFactoryClassMetadata for all mapped entities.getAllClassMetadata in interface SessionFactoryClassMetadata keyed by the
corresponding String entity-name.public Map getAllCollectionMetadata()
SessionFactoryCollectionMetadata for all mapped collections.getAllCollectionMetadata in interface SessionFactorypublic StatisticsImplementor getStatistics()
SessionFactorygetStatistics in interface SessionFactoryImplementorgetStatistics in interface SessionFactorypublic void close()
throws HibernateException
SessionFactorysessions before calling this method as the impact
on those sessions is indeterminate.
No-ops if already closed.close in interface Closeableclose in interface AutoCloseableclose in interface EntityManagerFactoryclose in interface SessionFactoryHibernateException - Indicates an issue closing the factory.public boolean isClosed()
SessionFactoryisClosed in interface SessionFactorypublic CacheImplementor getCache()
SessionFactorygetCache in interface EntityManagerFactorygetCache in interface SessionFactoryImplementorgetCache in interface SessionFactorypublic PersistenceUnitUtil getPersistenceUnitUtil()
EntityManagerFactorygetPersistenceUnitUtil in interface EntityManagerFactoryPersistenceUnitUtil interfacepublic void addNamedQuery(String name, Query query)
EntityManagerFactorycreateNamedQuery 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 EntityManagerFactoryname - name for the queryquery - Query, TypedQuery, or StoredProcedureQuery objectpublic <T> T unwrap(Class<T> cls)
EntityManagerFactoryunwrap in interface EntityManagerFactorycls - 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 Set getDefinedFilterNames()
SessionFactorygetDefinedFilterNames in interface SessionFactorypublic FilterDefinition getFilterDefinition(String filterName) throws HibernateException
SessionFactorygetFilterDefinition in interface SessionFactoryfilterName - The name of the filter for which to obtain the definition.HibernateException - If no filter defined with the given name.public boolean containsFetchProfileDefinition(String name)
SessionFactorycontainsFetchProfileDefinition in interface SessionFactoryname - The name to checkpublic TypeHelper getTypeHelper()
SessionFactoryTypeHelper.getTypeHelper in interface SessionFactoryTypeHelper@Deprecated public TypeResolver getTypeResolver()
Type resolver associated with this factory.getTypeResolver in interface SessionFactoryImplementorpublic Map<String,Object> getProperties()
EntityManagerFactorygetProperties in interface EntityManagerFactorypublic EntityPersister getEntityPersister(String entityName) throws MappingException
getEntityPersister in interface SessionFactoryImplementorMappingExceptionpublic Map<String,EntityPersister> getEntityPersisters()
getEntityPersisters in interface SessionFactoryImplementorpublic CollectionPersister getCollectionPersister(String role) throws MappingException
getCollectionPersister in interface SessionFactoryImplementorMappingExceptionpublic Map<String,CollectionPersister> getCollectionPersisters()
getCollectionPersisters in interface SessionFactoryImplementorpublic JdbcServices getJdbcServices()
SessionFactoryImplementorgetJdbcServices in interface SessionFactoryImplementorpublic Dialect getDialect()
SessionFactoryImplementorgetJdbcServices().getDialect()getDialect in interface SessionFactoryImplementorpublic Interceptor getInterceptor()
SessionFactoryImplementorgetInterceptor in interface SessionFactoryImplementorpublic QueryPlanCache getQueryPlanCache()
SessionFactoryImplementorgetQueryPlanCache in interface SessionFactoryImplementorpublic Type[] getReturnTypes(String queryString) throws HibernateException
SessionFactoryImplementorgetReturnTypes in interface SessionFactoryImplementorHibernateExceptionpublic String[] getReturnAliases(String queryString) throws HibernateException
SessionFactoryImplementorgetReturnAliases in interface SessionFactoryImplementorHibernateExceptionpublic String[] getImplementors(String className) throws MappingException
SessionFactoryImplementorgetImplementors in interface SessionFactoryImplementorMappingExceptionpublic String getImportedClassName(String name)
SessionFactoryImplementorgetImportedClassName in interface SessionFactoryImplementorpublic EntityGraph findEntityGraphByName(String name)
findEntityGraphByName in interface SessionFactoryImplementorpublic StatisticsImplementor getStatisticsImplementor()
getStatisticsImplementor in interface SessionFactoryImplementorpublic NamedQueryDefinition getNamedQuery(String queryName)
getNamedQuery in interface SessionFactoryImplementorpublic void registerNamedQueryDefinition(String name, NamedQueryDefinition definition)
registerNamedQueryDefinition in interface SessionFactoryImplementorpublic NamedSQLQueryDefinition getNamedSQLQuery(String queryName)
getNamedSQLQuery in interface SessionFactoryImplementorpublic void registerNamedSQLQueryDefinition(String name, NamedSQLQueryDefinition definition)
registerNamedSQLQueryDefinition in interface SessionFactoryImplementorpublic ResultSetMappingDefinition getResultSetMapping(String name)
getResultSetMapping in interface SessionFactoryImplementorpublic IdentifierGenerator getIdentifierGenerator(String rootEntityName)
SessionFactoryImplementorgetIdentifierGenerator in interface SessionFactoryImplementorpublic SQLExceptionConverter getSQLExceptionConverter()
SessionFactoryImplementorgetSQLExceptionConverter in interface SessionFactoryImplementorpublic SqlExceptionHelper getSQLExceptionHelper()
SessionFactoryImplementorgetSQLExceptionHelper in interface SessionFactoryImplementorpublic Settings getSettings()
getSettings in interface SessionFactoryImplementorpublic Session openTemporarySession() throws HibernateException
SessionFactoryImplementoropenTemporarySession in interface SessionFactoryImplementorHibernateExceptionpublic Set<String> getCollectionRolesByEntityParticipant(String entityName)
getCollectionRolesByEntityParticipant in interface SessionFactoryImplementorentityName - The entity name for which to get the collection roles.public EntityNotFoundDelegate getEntityNotFoundDelegate()
getEntityNotFoundDelegate in interface SessionFactoryImplementorpublic SQLFunctionRegistry getSqlFunctionRegistry()
getSqlFunctionRegistry in interface SessionFactoryImplementorpublic FetchProfile getFetchProfile(String name)
SessionFactoryImplementorgetFetchProfile in interface SessionFactoryImplementorname - The name of the profile to retrieve.public ServiceRegistryImplementor getServiceRegistry()
SessionFactoryImplementorgetServiceRegistry in interface SessionFactoryImplementorpublic void addObserver(SessionFactoryObserver observer)
addObserver in interface SessionFactoryImplementorpublic CustomEntityDirtinessStrategy getCustomEntityDirtinessStrategy()
getCustomEntityDirtinessStrategy in interface SessionFactoryImplementorpublic CurrentTenantIdentifierResolver getCurrentTenantIdentifierResolver()
getCurrentTenantIdentifierResolver in interface SessionFactoryImplementorpublic NamedQueryRepository getNamedQueryRepository()
SessionFactoryImplementorgetNamedQueryRepository in interface SessionFactoryImplementorpublic Iterable<EntityNameResolver> iterateEntityNameResolvers()
iterateEntityNameResolvers in interface SessionFactoryImplementorpublic EntityPersister locateEntityPersister(Class byClass)
locateEntityPersister in interface SessionFactoryImplementorpublic EntityPersister locateEntityPersister(String byName)
locateEntityPersister in interface SessionFactoryImplementorpublic SessionFactoryImplementor.DeserializationResolver getDeserializationResolver()
getDeserializationResolver in interface SessionFactoryImplementorpublic IdentifierGeneratorFactory getIdentifierGeneratorFactory()
MappinggetIdentifierGeneratorFactory in interface Mappingpublic Type getIdentifierType(String className) throws MappingException
getIdentifierType in interface MappingMappingExceptionpublic String getIdentifierPropertyName(String className) throws MappingException
getIdentifierPropertyName in interface MappingMappingExceptionpublic Type getReferencedPropertyType(String className, String propertyName) throws MappingException
getReferencedPropertyType in interface MappingMappingExceptionpublic String getUuid()
SessionFactoryImplementorUUID, but kept
as a String.getUuid in interface SessionFactoryImplementorSessionFactoryRegistry.getSessionFactory(java.lang.String)public String getName()
SessionFactoryImplementorgetName in interface SessionFactoryImplementorpublic Reference getReference() throws NamingException
getReference in interface ReferenceableNamingExceptionpublic <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 EntityManager createEntityManager()
EntityManagerFactoryEntityManager.
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 EntityManagerFactorypublic 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)
EntityManagerFactoryEntityManager 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 EntityManagerFactorysynchronizationType - how and when the entity manager should be
synchronized with the current JTA transactionpublic EntityManager createEntityManager(SynchronizationType synchronizationType, Map map)
EntityManagerFactoryEntityManager 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 EntityManagerFactorysynchronizationType - how and when the entity manager should be
synchronized with the current JTA transactionmap - properties for entity managerpublic CriteriaBuilder getCriteriaBuilder()
EntityManagerFactoryCriteriaBuilder for the creation of
CriteriaQuery objects.getCriteriaBuilder in interface EntityManagerFactorypublic MetamodelImplementor getMetamodel()
EntityManagerFactoryMetamodel interface for access to the
metamodel of the persistence unit.getMetamodel in interface EntityManagerFactorygetMetamodel in interface SessionFactoryImplementorgetMetamodel in interface HibernateEntityManagerFactorypublic boolean isOpen()
EntityManagerFactoryisOpen in interface EntityManagerFactorypublic Type resolveParameterBindType(Object bindValue)
resolveParameterBindType in interface QueryParameterBindingTypeResolverpublic Type resolveParameterBindType(Class clazz)
resolveParameterBindType in interface QueryParameterBindingTypeResolverCopyright © 2019 JBoss by Red Hat. All rights reserved.