Interface Mutiny.StatelessSession

  • All Superinterfaces:
    Mutiny.Closeable
    Enclosing interface:
    Mutiny

    public static interface Mutiny.StatelessSession
    extends Mutiny.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 Mutiny.Transaction and returns the result of the work as a Uni.
See Also:
Mutiny.SessionFactory.withTransaction(BiFunction)