@FunctionalInterface public interface ReactivePreparedStatementCallback<T>
PreparedStatement
. Allows to execute any number of
operations on a single PreparedStatement
, for example a single ReactiveSession#execute(Statement).
Used internally by {@link ReactiveCqlTemplate}, but also useful for application code. Note that the passed-in {@link PreparedStatement} can have been created by the framework or by a custom {@link ReactivePreparedStatementCreator}. However, the latter is hardly ever necessary, as most custom callback actions will perform updates in which case a standard {@link PreparedStatement is fine. Custom actions will always set parameter values themselves, so that {@link ReactivePreparedStatementCreator} capability is not needed either.
ReactiveCqlTemplate.execute(ReactivePreparedStatementCreator, ReactivePreparedStatementCallback)
,
ReactiveCqlTemplate.execute(String, ReactivePreparedStatementCallback)
Modifier and Type | Method and Description |
---|---|
org.reactivestreams.Publisher<T> |
doInPreparedStatement(ReactiveSession session,
com.datastax.driver.core.PreparedStatement ps)
Gets called by
ReactiveCqlTemplate.execute(String, ReactivePreparedStatementCallback) with an active CQL
session and PreparedStatement . |
org.reactivestreams.Publisher<T> doInPreparedStatement(ReactiveSession session, com.datastax.driver.core.PreparedStatement ps) throws com.datastax.driver.core.exceptions.DriverException, DataAccessException
ReactiveCqlTemplate.execute(String, ReactivePreparedStatementCallback)
with an active CQL
session and PreparedStatement
. Does not need to care about closing the session: this will all be handled by
Spring's ReactiveCqlTemplate
.
Allows for returning a result object created within the callback, i.e. a domain object or a collection of domain
objects. Note that there's special support for single step actions: see
ReactiveCqlTemplate.queryForObject(String, Class, Object...)
etc. A thrown RuntimeException is treated as
application exception, it gets propagated to the caller of the template.
session
- active Cassandra session, must not be null.ps
- the PreparedStatement
, must not be null.com.datastax.driver.core.exceptions.DriverException
- if thrown by a session method, to be auto-converted to a DataAccessException
.DataAccessException
- in case of custom exceptions.ReactiveCqlTemplate.queryForObject(String, Class, Object...)
,
ReactiveCqlTemplate.queryForFlux(String, Object...)
Copyright © 2011–2021 Pivotal Software, Inc.. All rights reserved.