Interface RawConnectionOperation<C extends Connection, R>

Type Parameters:
C - the connection type made available to the operation
R - the operation result type
Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

Performs raw JDBC work with a callback-scoped Connection managed by Database.

The connection type and safeguards depend on the useRawConnection(...) overload. The overload that accepts only this operation supplies a guarded standard JDBC connection. The overload that also accepts a connection class supplies an unguarded driver connection of the requested type so driver-specific APIs can be used.

In either case, the connection is valid only for the duration of the callback. Do not close it, retain it, manage transaction lifecycle directly from it, or mutate connection-wide state such as schema, catalog, client info, holdability, type map, or network timeout. All statements, result sets, appenders, readers, and other objects obtained from the connection must be closed before the callback returns.

Since:
4.2.0
Author:
Mark Allen
  • Method Summary

    Modifier and Type
    Method
    Description
    @NonNull Optional<R>
    perform(@NonNull C connection)
    Performs raw JDBC work with the provided connection.
  • Method Details

    • perform

      @NonNull Optional<R> perform(@NonNull C connection) throws Exception
      Performs raw JDBC work with the provided connection.
      Parameters:
      connection - connection to use
      Returns:
      the operation result
      Throws:
      Exception - if the operation fails