Package org.jdbi.v3.core.result
Class ResultProducers
java.lang.Object
org.jdbi.v3.core.result.ResultProducers
- All Implemented Interfaces:
JdbiConfig<ResultProducers>
Commonly used ResultProducer implementations.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interface
Returns a ResultSet from a Statement. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionallowNoResults
(boolean allowNoResults) Normally a query that doesn't return a result set throws an exception.Returns a copy of this configuration object.static ResultBearing
createResultBearing
(Supplier<PreparedStatement> preparedStatementSupplier, ResultProducers.ResultSetCreator resultSetCreator, StatementContext ctx) Create aResultBearing
instance backed by aResultSet
.static ResultProducer<ResultBearing>
returningGeneratedKeys
(String... generatedKeyColumnNames) Result producer that returns aResultBearing
over the statement-generated keys.static ResultProducer<ResultBearing>
Result producer that returns aResultBearing
over the statement result rows.static ResultProducer<Integer>
Result producer that eagerly executes the statement, returning the update countMethods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.jdbi.v3.core.config.JdbiConfig
setRegistry
-
Constructor Details
-
ResultProducers
public ResultProducers()
-
-
Method Details
-
returningUpdateCount
Result producer that eagerly executes the statement, returning the update count- Returns:
- update count
- See Also:
-
returningResults
Result producer that returns aResultBearing
over the statement result rows.- Returns:
- ResultBearing of result rows.
- See Also:
-
returningGeneratedKeys
public static ResultProducer<ResultBearing> returningGeneratedKeys(String... generatedKeyColumnNames) Result producer that returns aResultBearing
over the statement-generated keys.- Parameters:
generatedKeyColumnNames
- optional list of generated key column names.- Returns:
- ResultBearing of generated keys
- See Also:
-
createResultBearing
public static ResultBearing createResultBearing(Supplier<PreparedStatement> preparedStatementSupplier, ResultProducers.ResultSetCreator resultSetCreator, StatementContext ctx) Create aResultBearing
instance backed by aResultSet
. This method can be used to create otherResultProducer
instances that manage aResultBearing
instance.- Parameters:
preparedStatementSupplier
- Provides thePreparedStatement
to obtain theResultSet
.resultSetCreator
- Creates aResultSet
from aStatement
.ctx
- The statement context.- Returns:
- An instance of
ResultBearing
that is backed by theResultSet
.
-
createCopy
Description copied from interface:JdbiConfig
Returns a copy of this configuration object. Changes to the copy should not modify the original, and vice-versa.- Specified by:
createCopy
in interfaceJdbiConfig<ResultProducers>
- Returns:
- a copy of this configuration object.
-
allowNoResults
Normally a query that doesn't return a result set throws an exception. With this option, we will replace it with an empty result set instead.- Parameters:
allowNoResults
- True if an emptyResultSet
object should be returned, false if aNoResultsException
should be thrown.- Returns:
- this
-