Class StatementCustomizers
java.lang.Object
org.jdbi.v3.core.statement.StatementCustomizers
Some simple
StatementCustomizer
s you might find handy.-
Method Summary
Modifier and TypeMethodDescriptionstatic StatementCustomizer
fetchSize
(int fetchSize) Set the number of rows to fetch from the database in a single batch.static StatementCustomizer
maxFieldSize
(int maxFieldSize) Sets the limit of large variable size types likeVARCHAR
.static StatementCustomizer
maxRows
(int maxRows) Limit number of rows returned.static StatementCustomizer
statementTimeout
(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 aLIMIT
clause 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
-