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 Classes -
Field Summary
Fields -
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 ResultBearingcreateResultBearing(Supplier<PreparedStatement> preparedStatementSupplier, ResultProducers.ResultSetCreator resultSetCreator, StatementContext ctx) Create aResultBearinginstance backed by aResultSet.static ResultProducer<ResultBearing>returningGeneratedKeys(String... generatedKeyColumnNames) Result producer that returns aResultBearingover the statement-generated keys.static ResultProducer<ResultBearing>Result producer that returns aResultBearingover the statement result rows.static ResultProducer<Integer>Result producer that eagerly executes the statement, returning the update countMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.jdbi.v3.core.config.JdbiConfig
setRegistry
-
Field Details
-
allowNoResults
private boolean allowNoResults
-
-
Constructor Details
-
ResultProducers
public ResultProducers() -
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 aResultBearingover the statement result rows.- Returns:
- ResultBearing of result rows.
- See Also:
-
returningGeneratedKeys
public static ResultProducer<ResultBearing> returningGeneratedKeys(String... generatedKeyColumnNames) Result producer that returns aResultBearingover 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 aResultBearinginstance backed by aResultSet. This method can be used to create otherResultProducerinstances that manage aResultBearinginstance.- Parameters:
preparedStatementSupplier- Provides thePreparedStatementto obtain theResultSet.resultSetCreator- Creates aResultSetfrom aStatement.ctx- The statement context.- Returns:
- An instance of
ResultBearingthat is backed by theResultSet.
-
createCopy
Description copied from interface:JdbiConfigReturns a copy of this configuration object. Changes to the copy should not modify the original, and vice-versa.- Specified by:
createCopyin 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 emptyResultSetobject should be returned, false if aNoResultsExceptionshould be thrown.- Returns:
- this
-