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 interfaceReturns 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 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<Long> Result producer that eagerly executes the statement, returning the large update countstatic 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 Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface JdbiConfig
setRegistryModifier and TypeMethodDescriptiondefault voidsetRegistry(ConfigRegistry registry) The registry will inject itself into the configuration object.
-
Constructor Details
-
ResultProducers
public ResultProducers()
-
-
Method Details
-
returningUpdateCount
Result producer that eagerly executes the statement, returning the update count- Returns:
- update count
- See Also:
-
returningLargeUpdateCount
Result producer that eagerly executes the statement, returning the large update count- Returns:
- long 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
-