Описание тега hibernate-session
A main Java interface to Hibernate persistence service. The Hibernate Session embodies the concept of a persistence service (or persistence manager) that can be used to query and perform insert
, update
, and delete
operations on instances of a class mapped by Hibernate. Instances may exist in one of three states:
- transient (never persistent, not associated with any
Session
) - persistent (associated with a unique
Session
) - detached (previously persistent, not associated with any
Session
)
The ORM tool allows to perform all of these interactions using object-oriented
semantics by no longer referring to tables and columns, but using Java
classes and object properties. As its name implies, the Session
is a short-lived, lightweight object used as a bridge during a conversation between the application and the database. The Session
wraps the underlying JDBC connection or Java EE data source, and it serves as a first-level cache for persistent objects bound to it.
The Session object is not intended to be thread-safe, instead a new/current Session should be obtained from the session factory for each thread/transaction.
A Session instance is serializable if its persistent classes are serializable.