可用版本: Dev (3.21) | 最新 (3.20) | 3.19 | 3.18 | 3.17 | 3.16 | 3.15 | 3.14 | 3.13 | 3.12 | 3.11

自定义ExecuteListeners

适用于 ✅ 开源版   ✅ 专业版   ✅ 企业版

ExecuteListeners 是一个有用的工具,可以...

  • 实现自定义日志记录
  • 应用用 Java 编写的触发器
  • 收集查询执行统计信息

通过从 org.jooq.ExecuteListenerProvider 返回它们,将 ExecuteListeners 挂钩到你的 Configuration

// Create your Configuration
Configuration configuration = new DefaultConfiguration().set(connection).set(dialect);

// Hook your listener providers into the configuration:
configuration.set(
    new DefaultExecuteListenerProvider(new MyFirstListener()),
    new DefaultExecuteListenerProvider(new PerformanceLoggingListener()),
    new DefaultExecuteListenerProvider(new NoInsertListener())
);

请参阅手册中关于 ExecuteListeners 的章节,以查看此类监听器实现的示例。

反馈

您对此页面有任何反馈吗? 我们很乐意听取您的意见!

The jOOQ Logo