Hibernate's persistence service is exposed through different interfaces, including
Session, Query, Criteria, and
Transaction. Among these, the
Session interface has a crucial role, since any Hibernate interaction involves at least a
Session objects perform basic persistence operations. These include storing a newly instantiated object and loading, updating, and deleting an already persisted object.
Session objects provide a transaction handler to perform a set of persistence operations as a unit of work. Additionally, a
Session object provides a simple cache for the objects loaded, stored, or updated through it.
The Session API is generally used for the following purposes: