Package org.hibernate.jdbc

A small API allowing the client of a Hibernate session to interact directly with JDBC, using the same connection and transaction obtained by the session.

Work and ReturningWork define the notion of a unit of JDBC work that may be executed by the session at the request of the client. Execution of a unit of work may be requested by calling:

For example:

 session.doWork(connection -> {
     try ( PreparedStatement ps = connection.prepareStatement( " ... " ) ) {
         ps.execute();
     }
 });
 

The interface Expectation defines a contract for checking the results of a JDBC operation which executes user-written SQL:

An Expectation class may be specified along with the user-written SQL using SQLInsert.verify(), SQLUpdate.verify(), or SQLDelete.verify().
See Also:
Work, ReturningWork, Expectation