Requires a SessionFactory to be set, providing a HibernateTemplate
based on it to subclasses. Can alternatively be initialized directly via
a HibernateTemplate, to reuse the latter's settings like SessionFactory,
exception translator, flush mode, etc.

This base class is mainly intended for HibernateTemplate usage
but can also be used when working with SessionFactoryUtils directly,
e.g. in combination with HibernateInterceptor-managed Sessions.
Convenience getSession and closeSessionIfNecessary
methods are provided for that usage style.

This class will create its own HibernateTemplate if only a SessionFactory
is passed in. The allowCreate flag on that HibernateTemplate will be true by
default. A custom HibernateTemplate instance can be used through overriding
createHibernateTemplate.

getSession

Get a Hibernate Session, either from the current transaction or a new one.
The latter is only allowed if the "allowCreate" setting of this bean's
HibernateTemplate is true.

Note that this is not meant to be invoked from HibernateTemplate code
but rather just in plain Hibernate code. Either rely on a thread-bound
Session (via HibernateInterceptor), or use it in combination with
closeSessionIfNecessary.

In general, it is recommended to use HibernateTemplate, either with
the provided convenience operations or with a custom HibernateCallback
that provides you with a Session to work on. HibernateTemplate will care
for all resource management and for proper exception conversion.

getSession

Get a Hibernate Session, either from the current transaction or
a new one. The latter is only allowed if "allowCreate" is true.

Note that this is not meant to be invoked from HibernateTemplate code
but rather just in plain Hibernate code. Either rely on a thread-bound
Session (via HibernateInterceptor), or use it in combination with
closeSessionIfNecessary.

In general, it is recommended to use HibernateTemplate, either with
the provided convenience operations or with a custom HibernateCallback
that provides you with a Session to work on. HibernateTemplate will care
for all resource management and for proper exception conversion.

Parameters:

allowCreate - if a new Session should be created if no thread-bound found