Class StatementCustomizers

java.lang.Object
org.jdbi.v3.core.statement.StatementCustomizers

public final class StatementCustomizers extends Object
Some simple StatementCustomizers you might find handy.
  • Method Details

    • statementTimeout

      public static StatementCustomizer statementTimeout(int seconds)
      Set a timeout on the statement.
      Parameters:
      seconds - timeout in seconds
      Returns:
      the customizer
    • fetchSize

      public static StatementCustomizer fetchSize(int fetchSize)
      Set the number of rows to fetch from the database in a single batch. In a transaction, may enable streaming result sets instead of buffering in memory.
      Parameters:
      fetchSize - number of rows to fetch at a time
      Returns:
      the customizer
    • maxRows

      public static StatementCustomizer maxRows(int maxRows)
      Limit number of rows returned. Note that this may be significantly less efficient than doing it in the SQL with a LIMIT clause and is not recommended unless you understand why you need it specifically.
      Parameters:
      maxRows - number of rows to return
      Returns:
      the customizer
    • maxFieldSize

      public static StatementCustomizer maxFieldSize(int maxFieldSize)
      Sets the limit of large variable size types like VARCHAR. Limited data is silently discarded, so be careful!
      Parameters:
      maxFieldSize - the maximum field size to return
      Returns:
      the customizer