[hibernate-dev] inSession / inTransaction

Steve Ebersole steve at hibernate.org
Thu Dec 20 10:14:41 EST 2018


In tests we find our `#inSession` and `#inTransaction` methods very
useful.  Which got me thinking that maybe we should support these on
SessionFactory directly:

public interface SessionFactory ... {
    ...
    void inSession(Consumer<Session> action);
    void inTransaction(Consumer<Session> action);
    void inTransaction(Session session, Consumer<Session> action);
}

and maybe even:

public interface Session ... {
    void inTransaction(Consumer<Session> action);
}


Objections?


More information about the hibernate-dev mailing list