@FunctionalInterface public interface SessionCallback<T>
CqlSession. Allows to execute any number of
operations on a single session, using any type and number of statements.
This is particularly useful for delegating to existing data access code that expects a CqlSession to work on
and throws DriverException. For newly written code, it is strongly recommended to use CqlTemplate's
more specific operations, for example a query or update variant.
CqlTemplate.execute(SessionCallback),
CqlTemplate.query(java.lang.String, org.springframework.data.cassandra.core.cql.ResultSetExtractor<T>),
CqlTemplate.execute(String)| Modifier and Type | Method and Description |
|---|---|
T |
doInSession(com.datastax.oss.driver.api.core.CqlSession session)
Gets called by
CqlTemplate.execute(org.springframework.data.cassandra.core.cql.SessionCallback<T>) with an active Cassandra CqlSession. |
T doInSession(com.datastax.oss.driver.api.core.CqlSession session) throws com.datastax.oss.driver.api.core.DriverException, DataAccessException
CqlTemplate.execute(org.springframework.data.cassandra.core.cql.SessionCallback<T>) with an active Cassandra CqlSession. Does not need to care about
activating or closing the CqlSession.
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 CqlTemplate.queryForObject(java.lang.String, java.lang.Class<T>) 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.com.datastax.oss.driver.api.core.DriverException - if thrown by a Session method, to be auto-converted to a DataAccessException.DataAccessException - in case of custom exceptions.CqlTemplate.queryForObject(String, Class),
CqlTemplate.queryForResultSet(String)Copyright © 2011–2021 Pivotal Software, Inc.. All rights reserved.