Описание тега sessionfactory
A main interface used by the application to obtain a Hibernate session. Hibernate requires to provide it with the configuration information required to connect to each database being used by an application as well as which classes are mapped to a given database. Each one of these database-specific configuration files, along with the associated class mappings, are compiled and cached by the SessionFactory
, which is used to obtain Hibernate sessions. The SessionFactory
is a heavyweight object that should ideally be created only once (since it's an expensive and slow operation) and threads servicing client requests obtain Session
instances from this factory. Initially the SessionFactory
should made available to the application that needs to perform persistence operations.