Package org.jdbi.v3.core.statement
Class StatementCustomizers
java.lang.Object
org.jdbi.v3.core.statement.StatementCustomizers
Some simple
StatementCustomizers you might find handy.-
Method Summary
Modifier and TypeMethodDescriptionstatic StatementCustomizerfetchSize(int fetchSize) Set the number of rows to fetch from the database in a single batch.static StatementCustomizermaxFieldSize(int maxFieldSize) Sets the limit of large variable size types likeVARCHAR.static StatementCustomizermaxRows(int maxRows) Limit number of rows returned.static StatementCustomizerstatementTimeout(int seconds) Set a timeout on the statement.
-
Method Details
-
statementTimeout
Set a timeout on the statement.- Parameters:
seconds- timeout in seconds- Returns:
- the customizer
-
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
Limit number of rows returned. Note that this may be significantly less efficient than doing it in the SQL with aLIMITclause and is not recommended unless you understand why you need it specifically.- Parameters:
maxRows- number of rows to return- Returns:
- the customizer
-
maxFieldSize
Sets the limit of large variable size types likeVARCHAR. Limited data is silently discarded, so be careful!- Parameters:
maxFieldSize- the maximum field size to return- Returns:
- the customizer
-