Я использую PreparedStatement и boundStatment для выполнения некоторых запросов Cassandra.Я пытаюсь выполнить запрос диапазона.Это запрос, который я хочу создать:
getAllRecordsOnIndexRange = getSession.prepare(QueryBuilder.select(documentId, documentName, documentIndex)
.from(tableName)
.where(QueryBuilder.eq(documentId,QueryBuilder.bindMarker()))
.and(QueryBuilder.gte(documentIndex, QueryBuilder.bindMarker()))
.and(QueryBuilder.lte(documentIndex, QueryBuilder.bindMarker())));
'documentId' - это ключ раздела, а 'documentIndex' - это ключ кластеризации.Я хочу иметь запрос диапазона для столбца documentIndex, например "получить все записи с заданным documentId и documentIndex> = 3 и documentIndex <= 10" </p>
Когда я хочу выполнить запрос, я вызываю
public Statement buildGetAllRecordsOnIndexRange(int documentId, String documentName, int startDocumentIndex, int endDocumentIndex)
{
BoundStatement boundStatement = getAllRecordsOnIndexRange
.bind()
.setString(DOCUMENT_ID, documentId)
//how to set start and end documentIndex
databaseManager.applyReadStatementsConfiguration(boundStatement);
return boundStatement;
}
Как я могу установить startDocumentIndex и endDocumentIndex для вышеуказанного запроса?