diff --git a/pom.xml b/pom.xml
index 9d2f70be2..99cdb55c8 100644
--- a/pom.xml
+++ b/pom.xml
@@ -11,7 +11,7 @@
org.springframework.dataspring-data-cassandra-parent
- 5.0.0-SNAPSHOT
+ 5.0.0-SEARCH-SNAPSHOTpomSpring Data for Apache Cassandra
@@ -92,12 +92,8 @@
5.0.34.19.0spring-data-cassandra
- 1.0
-
- 0.5.41.01
- multi
- 4.0.0-SNAPSHOT
+ 4.0.0-SEARCH-RESULT-SNAPSHOT
@@ -158,13 +154,6 @@
test
-
- com.carrotsearch
- hppc
- ${hppc.version}
- test
-
-
edu.umd.cs.mtcmultithreadedtc
diff --git a/spring-data-cassandra-distribution/pom.xml b/spring-data-cassandra-distribution/pom.xml
index cf545591f..3458d30bc 100644
--- a/spring-data-cassandra-distribution/pom.xml
+++ b/spring-data-cassandra-distribution/pom.xml
@@ -8,7 +8,7 @@
org.springframework.dataspring-data-cassandra-parent
- 5.0.0-SNAPSHOT
+ 5.0.0-SEARCH-SNAPSHOT../pom.xml
diff --git a/spring-data-cassandra/pom.xml b/spring-data-cassandra/pom.xml
index 7f28c7f2b..127b50246 100644
--- a/spring-data-cassandra/pom.xml
+++ b/spring-data-cassandra/pom.xml
@@ -8,7 +8,7 @@
org.springframework.dataspring-data-cassandra-parent
- 5.0.0-SNAPSHOT
+ 5.0.0-SEARCH-SNAPSHOT../pom.xml
@@ -167,6 +167,14 @@
javax.injectjavax.inject
+
+ org.perfkit.sjk.parsers
+ *
+
+
+ com.jrockit.mc
+ *
+
@@ -198,11 +206,6 @@
multithreadedtc
-
- com.carrotsearch
- hppc
-
-
org.jetbrains.kotlin
diff --git a/spring-data-cassandra/src/main/java/org/springframework/data/cassandra/core/AsyncCassandraOperations.java b/spring-data-cassandra/src/main/java/org/springframework/data/cassandra/core/AsyncCassandraOperations.java
index febc49b4f..90cdc8f76 100644
--- a/spring-data-cassandra/src/main/java/org/springframework/data/cassandra/core/AsyncCassandraOperations.java
+++ b/spring-data-cassandra/src/main/java/org/springframework/data/cassandra/core/AsyncCassandraOperations.java
@@ -128,7 +128,7 @@ CompletableFuture select(String cql, Consumer entityConsumer, Class
/**
* Execute a {@code SELECT} query with paging and convert the result set to a {@link Slice} of entities. A sliced
- * query translates the effective {@link Statement#getFetchSize() fetch size} to the page size.
+ * query translates the effective {@link Statement#getPageSize() fetch size} to the page size.
*
* @param statement the CQL statement, must not be {@literal null}.
* @param entityClass The entity type must not be {@literal null}.
diff --git a/spring-data-cassandra/src/main/java/org/springframework/data/cassandra/core/CassandraOperations.java b/spring-data-cassandra/src/main/java/org/springframework/data/cassandra/core/CassandraOperations.java
index 943473ee2..a7a970cd2 100644
--- a/spring-data-cassandra/src/main/java/org/springframework/data/cassandra/core/CassandraOperations.java
+++ b/spring-data-cassandra/src/main/java/org/springframework/data/cassandra/core/CassandraOperations.java
@@ -20,6 +20,7 @@
import java.util.stream.Stream;
import org.jspecify.annotations.Nullable;
+
import org.springframework.dao.DataAccessException;
import org.springframework.data.cassandra.core.convert.CassandraConverter;
import org.springframework.data.cassandra.core.cql.CqlOperations;
@@ -92,7 +93,7 @@ default CassandraBatchOperations batchOps() {
/**
* The table name used for the specified class by this template.
*
- * @param entityClass The entity type must not be {@literal null}.
+ * @param entityClass the entity type must not be {@literal null}.
* @return the {@link CqlIdentifier}
*/
CqlIdentifier getTableName(Class> entityClass);
@@ -105,7 +106,7 @@ default CassandraBatchOperations batchOps() {
* Execute a {@code SELECT} query and convert the resulting items to a {@link List} of entities.
*
* @param cql must not be {@literal null}.
- * @param entityClass The entity type must not be {@literal null}.
+ * @param entityClass the entity type must not be {@literal null}.
* @return the converted results
* @throws DataAccessException if there is any problem executing the query.
*/
@@ -129,7 +130,7 @@ default CassandraBatchOperations batchOps() {
* Execute a {@code SELECT} query and convert the resulting item to an entity.
*
* @param cql must not be {@literal null}.
- * @param entityClass The entity type must not be {@literal null}.
+ * @param entityClass the entity type must not be {@literal null}.
* @return the converted object or {@literal null}.
* @throws DataAccessException if there is any problem executing the query.
*/
@@ -154,7 +155,7 @@ default CassandraBatchOperations batchOps() {
* Execute a {@code SELECT} query and convert the resulting items to a {@link List} of entities.
*
* @param statement must not be {@literal null}.
- * @param entityClass The entity type must not be {@literal null}.
+ * @param entityClass the entity type must not be {@literal null}.
* @return the converted results
* @throws DataAccessException if there is any problem executing the query.
*/
@@ -162,10 +163,10 @@ default CassandraBatchOperations batchOps() {
/**
* Execute a {@code SELECT} query with paging and convert the result set to a {@link Slice} of entities. A sliced
- * query translates the effective {@link Statement#getFetchSize() fetch size} to the page size.
+ * query translates the effective {@link Statement#getPageSize()} to the page size.
*
* @param statement the CQL statement, must not be {@literal null}.
- * @param entityClass The entity type must not be {@literal null}.
+ * @param entityClass the entity type must not be {@literal null}.
* @return the converted results
* @throws DataAccessException if there is any problem executing the query.
* @since 2.0
@@ -190,7 +191,7 @@ default CassandraBatchOperations batchOps() {
* Execute a {@code SELECT} query and convert the resulting item to an entity.
*
* @param statement must not be {@literal null}.
- * @param entityClass The entity type must not be {@literal null}.
+ * @param entityClass the entity type must not be {@literal null}.
* @return the converted object or {@literal null}.
* @throws DataAccessException if there is any problem executing the query.
*/
@@ -204,7 +205,7 @@ default CassandraBatchOperations batchOps() {
* Execute a {@code SELECT} query and convert the resulting items to a {@link List} of entities.
*
* @param query must not be {@literal null}.
- * @param entityClass The entity type must not be {@literal null}.
+ * @param entityClass the entity type must not be {@literal null}.
* @return the converted results
* @throws DataAccessException if there is any problem executing the query.
* @since 2.0
@@ -215,7 +216,7 @@ default CassandraBatchOperations batchOps() {
* Execute a {@code SELECT} query with paging and convert the result set to a {@link Slice} of entities.
*
* @param query the query object used to create a CQL statement, must not be {@literal null}.
- * @param entityClass The entity type must not be {@literal null}.
+ * @param entityClass the entity type must not be {@literal null}.
* @return the converted results
* @throws DataAccessException if there is any problem executing the query.
* @since 2.0
@@ -241,7 +242,7 @@ default CassandraBatchOperations batchOps() {
* Execute a {@code SELECT} query and convert the resulting item to an entity.
*
* @param query must not be {@literal null}.
- * @param entityClass The entity type must not be {@literal null}.
+ * @param entityClass the entity type must not be {@literal null}.
* @return the converted object or {@literal null}.
* @throws DataAccessException if there is any problem executing the query.
* @since 2.0
@@ -253,7 +254,7 @@ default CassandraBatchOperations batchOps() {
*
* @param query must not be {@literal null}.
* @param update must not be {@literal null}.
- * @param entityClass The entity type must not be {@literal null}.
+ * @param entityClass the entity type must not be {@literal null}.
* @throws DataAccessException if there is any problem executing the query.
*/
boolean update(Query query, Update update, Class> entityClass) throws DataAccessException;
@@ -262,7 +263,7 @@ default CassandraBatchOperations batchOps() {
* Remove entities (rows)/columns from the table by {@link Query}.
*
* @param query must not be {@literal null}.
- * @param entityClass The entity type must not be {@literal null}.
+ * @param entityClass the entity type must not be {@literal null}.
* @throws DataAccessException if there is any problem executing the query.
*/
boolean delete(Query query, Class> entityClass) throws DataAccessException;
@@ -322,7 +323,7 @@ default CassandraBatchOperations batchOps() {
* @param id the Id value. For single primary keys it's the plain value. For composite primary keys either the
* {@link org.springframework.data.cassandra.core.mapping.PrimaryKeyClass} or
* {@link org.springframework.data.cassandra.core.mapping.MapId}. Must not be {@literal null}.
- * @param entityClass The entity type must not be {@literal null}.
+ * @param entityClass the entity type must not be {@literal null}.
* @return the converted object or {@literal null}.
* @throws DataAccessException if there is any problem executing the query.
*/
@@ -407,7 +408,7 @@ default WriteResult delete(Object entity, DeleteOptions options) throws DataAcce
* @param id the Id value. For single primary keys it's the plain value. For composite primary keys either the
* {@link org.springframework.data.cassandra.core.mapping.PrimaryKeyClass} or
* {@link org.springframework.data.cassandra.core.mapping.MapId}. Must not be {@literal null}.
- * @param entityClass The entity type must not be {@literal null}.
+ * @param entityClass the entity type must not be {@literal null}.
* @throws DataAccessException if there is any problem executing the query.
*/
boolean deleteById(Object id, Class> entityClass) throws DataAccessException;
@@ -415,7 +416,7 @@ default WriteResult delete(Object entity, DeleteOptions options) throws DataAcce
/**
* Execute a {@code TRUNCATE} query to remove all entities of a given class.
*
- * @param entityClass The entity type must not be {@literal null}.
+ * @param entityClass the entity type must not be {@literal null}.
* @throws DataAccessException if there is any problem executing the query.
*/
void truncate(Class> entityClass) throws DataAccessException;
diff --git a/spring-data-cassandra/src/main/java/org/springframework/data/cassandra/core/CassandraTemplate.java b/spring-data-cassandra/src/main/java/org/springframework/data/cassandra/core/CassandraTemplate.java
index 9ec3804cb..163f37098 100644
--- a/spring-data-cassandra/src/main/java/org/springframework/data/cassandra/core/CassandraTemplate.java
+++ b/spring-data-cassandra/src/main/java/org/springframework/data/cassandra/core/CassandraTemplate.java
@@ -58,6 +58,7 @@
import org.springframework.data.projection.EntityProjection;
import org.springframework.data.projection.ProjectionFactory;
import org.springframework.data.projection.SpelAwareProxyProjectionFactory;
+import org.springframework.data.util.Lazy;
import org.springframework.util.Assert;
import com.datastax.oss.driver.api.core.CqlIdentifier;
@@ -353,10 +354,18 @@ public List select(Statement> statement, Class entityClass) {
Assert.notNull(statement, "Statement must not be null");
Assert.notNull(entityClass, "Entity type must not be null");
- Function mapper = getMapper(EntityProjection.nonProjecting(entityClass),
- EntityQueryUtils.getTableName(statement));
+ return doSelect(statement, entityClass, EntityQueryUtils.getTableName(statement), entityClass,
+ QueryResultConverter.entity());
+ }
+
+ List doSelect(Statement> statement, Class> entityClass, CqlIdentifier tableName, Class returnType,
+ QueryResultConverter mappingFunction) {
+
+ EntityProjection projection = entityOperations.introspectProjection(returnType, entityClass);
+
+ RowMapper rowMapper = getRowMapper(projection, tableName, mappingFunction);
- return doQuery(statement, (row, rowNum) -> mapper.apply(row));
+ return doQuery(statement, rowMapper);
}
@Override
@@ -372,13 +381,14 @@ public Slice slice(Statement> statement, Class entityClass) {
Assert.notNull(statement, "Statement must not be null");
Assert.notNull(entityClass, "Entity type must not be null");
- ResultSet resultSet = doQueryForResultSet(statement);
+ return doSlice(statement,
+ getRowMapper(entityClass, EntityQueryUtils.getTableName(statement), QueryResultConverter.entity()));
+ }
- Function mapper = getMapper(EntityProjection.nonProjecting(entityClass),
- EntityQueryUtils.getTableName(statement));
+ Slice doSlice(Statement> statement, RowMapper mapper) {
- return EntityQueryUtils.readSlice(resultSet, (row, rowNum) -> mapper.apply(row), 0,
- getEffectivePageSize(statement));
+ ResultSet resultSet = doQueryForResultSet(statement);
+ return EntityQueryUtils.readSlice(resultSet, mapper, 0, getEffectivePageSize(statement));
}
@Override
@@ -387,9 +397,17 @@ public Stream stream(Statement> statement, Class entityClass) throws
Assert.notNull(statement, "Statement must not be null");
Assert.notNull(entityClass, "Entity type must not be null");
- Function mapper = getMapper(EntityProjection.nonProjecting(entityClass),
- EntityQueryUtils.getTableName(statement));
- return doQueryForStream(statement, (row, rowNum) -> mapper.apply(row));
+ return doStream(statement, entityClass, EntityQueryUtils.getTableName(statement), entityClass,
+ QueryResultConverter.entity());
+ }
+
+ Stream doStream(Statement> statement, Class> entityClass, CqlIdentifier tableName, Class returnType,
+ QueryResultConverter mappingFunction) {
+
+ EntityProjection projection = entityOperations.introspectProjection(returnType, entityClass);
+
+ RowMapper rowMapper = getRowMapper(projection, tableName, mappingFunction);
+ return doQueryForStream(statement, rowMapper);
}
// -------------------------------------------------------------------------
@@ -402,10 +420,11 @@ public List select(Query query, Class entityClass) throws DataAccessEx
Assert.notNull(query, "Query must not be null");
Assert.notNull(entityClass, "Entity type must not be null");
- return doSelect(query, entityClass, getTableName(entityClass), entityClass);
+ return doSelect(query, entityClass, getTableName(entityClass), entityClass, QueryResultConverter.entity());
}
- List doSelect(Query query, Class> entityClass, CqlIdentifier tableName, Class returnType) {
+ List doSelect(Query query, Class> entityClass, CqlIdentifier tableName, Class returnType,
+ QueryResultConverter super T, ? extends R> mappingFunction) {
CassandraPersistentEntity> entity = getRequiredPersistentEntity(entityClass);
EntityProjection projection = entityOperations.introspectProjection(returnType, entityClass);
@@ -415,9 +434,9 @@ List doSelect(Query query, Class> entityClass, CqlIdentifier tableName,
Query queryToUse = query.columns(columns);
StatementBuilder