org.hibernate.SessionFactory |
Known Indirect Subclasses |
The main contract here is the creation of Session
instances. Usually
an application has a single SessionFactory
instance and threads
servicing client requests obtain Session
instances from this factory.
SessionFactory
is immutable. Once it is created
this internal state is set. This internal state includes all of the metadata
about Object/Relational Mapping.
Implementors must be threadsafe.
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Destroy this SessionFactory and release all resources (caches,
connection pools, etc).
| |||||||||||
Determine if this session factory contains a fetch profile definition
registered under the given name.
| |||||||||||
This method is deprecated.
Use
containsEntity(Class, Serializable) accessed through
getCache() instead.
| |||||||||||
This method is deprecated.
Use
evictEntityRegion(Class) accessed through
getCache() instead.
| |||||||||||
This method is deprecated.
Use
evictCollection(String, Serializable) accessed through
getCache() instead.
| |||||||||||
This method is deprecated.
Use
evictCollectionRegion(String) accessed through
getCache() instead.
| |||||||||||
This method is deprecated.
Use
evictEntityRegion(String) accessed through
getCache() instead.
| |||||||||||
This method is deprecated.
Use
evictEntity(String, Serializable) accessed through
getCache() instead.
| |||||||||||
This method is deprecated.
Use
evictQueryRegions() accessed through
getCache() instead.
| |||||||||||
This method is deprecated.
Use
evictQueryRegion(String) accessed through
getCache() instead.
| |||||||||||
Retrieve the
ClassMetadata for all mapped entities. | |||||||||||
Get the
CollectionMetadata for all mapped collections | |||||||||||
Obtain direct access to the underlying cache regions.
| |||||||||||
Retrieve the
ClassMetadata associated with the given entity class. | |||||||||||
Retrieve the
ClassMetadata associated with the given entity class. | |||||||||||
Get the
CollectionMetadata associated with the named collection role. | |||||||||||
Obtains the current session.
| |||||||||||
Obtain a set of the names of all filters defined on this SessionFactory.
| |||||||||||
Obtain the definition of a filter by name.
| |||||||||||
Retrieve the statistics fopr this factory.
| |||||||||||
Retrieve this factory's
TypeHelper | |||||||||||
Is this factory already closed?
| |||||||||||
Open a
Session . | |||||||||||
Open a
Session , utilizing the specfied JDBC Connection . | |||||||||||
Open a
Session , utilizing the specified Interceptor . | |||||||||||
Open a new stateless session, utilizing the specified JDBC
Connection . | |||||||||||
Open a new stateless session.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From interface
javax.naming.Referenceable
|
Destroy this SessionFactory and release all resources (caches, connection pools, etc).
It is the responsibility of the application to ensure that there are no opensessions
before calling this method as the impact
on those sessions
is indeterminate.
No-ops if already closed
.HibernateException | Indicates an issue closing the factory. |
---|
Determine if this session factory contains a fetch profile definition registered under the given name.
name | The name to check |
---|
This method is deprecated.
Use containsEntity(Class, Serializable)
accessed through
getCache()
instead.
Evict an entry from the second-level cache. This method occurs outside of any transaction; it performs an immediate "hard" remove, so does not respect any transaction isolation semantics of the usage strategy. Use with care.
persistentClass | The entity class for which to evict data. |
---|---|
id | The entity id |
HibernateException | Generally will mean that either that 'persisttentClass' did not name a mapped entity or a problem communicating with underlying cache impl. |
---|
This method is deprecated.
Use evictEntityRegion(Class)
accessed through
getCache()
instead.
Evict all entries from the second-level cache. This method occurs outside of any transaction; it performs an immediate "hard" remove, so does not respect any transaction isolation semantics of the usage strategy. Use with care.
persistentClass | The entity class for which to evict data. |
---|
HibernateException | Generally will mean that either that 'persisttentClass' did not name a mapped entity or a problem communicating with underlying cache impl. |
---|
This method is deprecated.
Use evictCollection(String, Serializable)
accessed through
getCache()
instead.
Evict an entry from the second-level cache. This method occurs outside of any transaction; it performs an immediate "hard" remove, so does not respect any transaction isolation semantics of the usage strategy. Use with care.
roleName | The name of the collection role |
---|---|
id | The id of the collection owner |
HibernateException | Generally will mean that either that 'roleName' did not name a mapped collection or a problem communicating with underlying cache impl. |
---|
This method is deprecated.
Use evictCollectionRegion(String)
accessed through
getCache()
instead.
Evict all entries from the second-level cache. This method occurs outside of any transaction; it performs an immediate "hard" remove, so does not respect any transaction isolation semantics of the usage strategy. Use with care.
roleName | The name of the collection role whose regions should be evicted |
---|
HibernateException | Generally will mean that either that 'roleName' did not name a mapped collection or a problem communicating with underlying cache impl. |
---|
This method is deprecated.
Use evictEntityRegion(String)
accessed through
getCache()
instead.
Evict all entries from the second-level cache. This method occurs outside of any transaction; it performs an immediate "hard" remove, so does not respect any transaction isolation semantics of the usage strategy. Use with care.
entityName | The entity name for which to evict data. |
---|
HibernateException | Generally will mean that either that 'persisttentClass' did not name a mapped entity or a problem communicating with underlying cache impl. |
---|
This method is deprecated.
Use evictEntity(String, Serializable)
accessed through
getCache()
instead.
Evict an entry from the second-level cache. This method occurs outside of any transaction; it performs an immediate "hard" remove, so does not respect any transaction isolation semantics of the usage strategy. Use with care.
entityName | The entity name for which to evict data. |
---|---|
id | The entity id |
HibernateException | Generally will mean that either that 'persisttentClass' did not name a mapped entity or a problem communicating with underlying cache impl. |
---|
This method is deprecated.
Use evictQueryRegions()
accessed through
getCache()
instead.
Evict any query result sets cached in the default query cache region.
HibernateException | Indicate a problem communicating with underlying cache impl. |
---|
This method is deprecated.
Use evictQueryRegion(String)
accessed through
getCache()
instead.
Evict any query result sets cached in the named query cache region.
cacheRegion | The named query cache region from which to evict. |
---|
HibernateException | Since a not-found 'cacheRegion' simply no-ops, this should indicate a problem communicating with underlying cache impl. |
---|
Retrieve the ClassMetadata
for all mapped entities.
ClassMetadata
keyed by the
corresponding String
entity-name.HibernateException | Generally empty map is returned instead of throwing. |
---|
Get the CollectionMetadata
for all mapped collections
HibernateException | Generally empty map is returned instead of throwing. |
---|
Obtain direct access to the underlying cache regions.
Retrieve the ClassMetadata
associated with the given entity class.
entityClass | The entity class |
---|
HibernateException | Generally null is returned instead of throwing. |
---|
Retrieve the ClassMetadata
associated with the given entity class.
entityName | The entity class |
---|
HibernateException | Generally null is returned instead of throwing. |
---|
Get the CollectionMetadata
associated with the named collection role.
roleName | The collection role (in form [owning-entity-name].[collection-property-name]). |
---|
HibernateException | Generally null is returned instead of throwing. |
---|
Obtains the current session. The definition of what exactly "current"
means controlled by the CurrentSessionContext
impl configured
for use.
CurrentSessionContext
is not configured but a JTA TransactionManagerLookup
is configured this will default to the JTASessionContext
impl.HibernateException | Indicates an issue locating a suitable current session. |
---|
Obtain a set of the names of all filters defined on this SessionFactory.
Obtain the definition of a filter by name.
filterName | The name of the filter for which to obtain the definition. |
---|
HibernateException | If no filter defined with the given name. |
---|
Retrieve the statistics fopr this factory.
Retrieve this factory's TypeHelper
TypeHelper
Is this factory already closed?
Open a Session
, utilizing the specfied JDBC Connection
and
specified Interceptor
.
Note that the second-level cache will be disabled if you supply a JDBC
connection. Hibernate will not be able to track any statements you might
have executed in the same transaction. Consider implementing your own
ConnectionProvider
instead as a highly
recommended alternative.
connection | a connection provided by the application. |
---|---|
interceptor | a session-scoped interceptor |
Open a Session
.
connection(s
will be obtained from the
configured ConnectionProvider
as needed
to perform requested work.HibernateException | Indicates a peroblem opening the session; pretty rare here. |
---|
Open a Session
, utilizing the specfied JDBC Connection
.
Note that the second-level cache will be disabled if you supply a JDBC
connection. Hibernate will not be able to track any statements you might
have executed in the same transaction. Consider implementing your own
ConnectionProvider
instead as a highly
recommended alternative.
connection | a connection provided by the application. |
---|
Open a Session
, utilizing the specified Interceptor
.
connection(s
will be obtained from the
configured ConnectionProvider
as needed
to perform requested work.interceptor | a session-scoped interceptor |
---|
HibernateException | Indicates a peroblem opening the session; pretty rare here. |
---|
Open a new stateless session, utilizing the specified JDBC
Connection
.
connection | Connection provided by the application. |
---|
Open a new stateless session.