Interface ConnectionCallback

All Known Subinterfaces:
DatabaseMetaDataCallback

public interface ConnectionCallback
A callback interface for executing database operations. This provides lifecycle management, by using this you don't need to worry about closing the database connection.
Author:
jbanes
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    execute(Connection connection)
    Executes database operations with the provided connection.
    static void
    Utility method that handles connection lifecycle (open/close) and exception handling.
  • Method Details

    • execute

      void execute(Connection connection) throws SQLException
      Executes database operations with the provided connection.
      Parameters:
      connection - The JDBC connection to use
      Throws:
      SQLException - If a database access error occurs
    • execute

      static void execute(DataSource source, ConnectionCallback callback)
      Utility method that handles connection lifecycle (open/close) and exception handling.
      Parameters:
      source - The data source to obtain a connection from.
      callback - The callback defining operations to perform.
      Throws:
      com.invirgance.convirgance.ConvirganceException - Wrapping any SQLExceptions that occur