Interface StatementObserver

All Superinterfaces:
EntityAgent.CreationOption, EntityManager.CreationOption

@Incubating public interface StatementObserver extends EntityManager.CreationOption, EntityAgent.CreationOption

Observation of (almost) all JDBC statements performed by Hibernate.

Generally "performed" means calls to Statement.execute(String), Statement.executeQuery(String) or Statement.executeUpdate(String). In these cases, performingSql(String, int) is called with -1 as the batchPosition.

In JDBC batching cases, performingSql(String, int) is called for each Statement.addBatch(String) call. In these cases, batchPosition is the addition's position within the current batch.

Since:
8.0
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    performingSql(String sql, int batchPosition)
    Callback that the given sql is about to be performed.
  • Method Details

    • performingSql

      void performingSql(String sql, int batchPosition)
      Callback that the given sql is about to be performed.
      Parameters:
      sql - The SQL which is being performed.
      batchPosition - The position within a batch; -1 if not batched.
      API Note:
      "Performed" here could mean immediately executed, or added to a JDBC batch.