Interface Stage.StatelessSession

  • All Superinterfaces:
    Stage.Closeable
    Enclosing interface:
    Stage

    public static interface Stage.StatelessSession
    extends Stage.Closeable
    A non-blocking counterpart to the Hibernate StatelessSession interface, which provides a command-oriented API for performing bulk operations against a database.

    A stateless session does not implement a first-level cache nor interact with any second-level cache, nor does it implement transactional write-behind or automatic dirty checking, nor do operations cascade to associated instances. Changes to many to many associations and element collections may not be made persistent in a stateless session. Operations performed via a stateless session bypass Hibernate's event model and interceptors.

    For certain kinds of work, a stateless session may perform slightly better than a stateful session.

    In particular, for a session which loads many entities, use of a StatelessSession alleviates the need to call:

    Stateless sessions are vulnerable to data aliasing effects, due to the lack of a first-level cache.

    See Also:
    StatelessSession
Parameters:
work - a function which accepts Stage.Transaction and returns the result of the work as a CompletionStage.
See Also:
Stage.SessionFactory.withTransaction(BiFunction)