diff --git a/spring-data-cassandra/src/main/java/org/springframework/data/cassandra/repository/CassandraRepository.java b/spring-data-cassandra/src/main/java/org/springframework/data/cassandra/repository/CassandraRepository.java
index 27bf5665e..7e490a436 100644
--- a/spring-data-cassandra/src/main/java/org/springframework/data/cassandra/repository/CassandraRepository.java
+++ b/spring-data-cassandra/src/main/java/org/springframework/data/cassandra/repository/CassandraRepository.java
@@ -1,36 +1,83 @@
+/*
+ * Copyright 2013-2017 the original author or authors
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
package org.springframework.data.cassandra.repository;
-import org.springframework.data.cassandra.core.mapping.PrimaryKeyColumn;
-import org.springframework.data.cassandra.repository.support.BasicMapId;
+import java.util.List;
+
+import org.springframework.data.cassandra.core.mapping.Table;
+import org.springframework.data.domain.Persistable;
+import org.springframework.data.repository.CrudRepository;
import org.springframework.data.repository.NoRepositoryBean;
/**
- * Basic Cassandra repository interface.
- *
- * This interface uses {@link MapId} for the id type, allowing you to annotate entity fields or properties with
- * {@link PrimaryKeyColumn @PrimaryKeyColumn}. For a full discussion of this interface, including the use of custom
- * primary key classes, see {@link TypedIdCassandraRepository}.
- *
- * Steps to use this interface:
- *
- *
Define your entity, including a field or property for each column, including those for partition and (optional)
- * cluster columns.
- *
Annotate each partition & cluster field or property with {@link PrimaryKeyColumn @PrimaryKeyColumn}
- *
Define your repository interface to be a subinterface of this interface, which uses a provided id type,
- * {@link MapId} (implemented by {@link BasicMapId}).
- *
Whenever you need a {@link MapId}, you can use the static factory method {@link BasicMapId#id()} (which is
- * convenient if you import statically) and the builder method {@link MapId#with(String, Object)} to easily construct an
- * id.
- *
Optionally, entity class authors can have their entities implement {@link MapIdentifiable}, to make it easier and
- * quicker for entity clients to get the entity's identity.
- *
+ * Cassandra-specific extension of the {@link CrudRepository} interface that allows the specification of a type for the
+ * identity of the {@link Table @Table} (or {@link Persistable @Persistable}) type.
+ *
+ * Repositories based on {@link CassandraRepository} can define either a single primary key, use a primary key class or
+ * a compound primary key without a primary key class. Types using a compound primary key without a primary key class
+ * must use {@link MapId} to declare their key value.
*
- * @param The type of the persistent entity.
- * @see TypedIdCassandraRepository
- * @see MapId
- * @See {@link MapIdentifiable}
+ * @author Alex Shvid
* @author Matthew T. Adams
* @author Mark Paluch
+ * @see MapIdCassandraRepository
*/
@NoRepositoryBean
-public interface CassandraRepository extends TypedIdCassandraRepository {}
+public interface CassandraRepository extends CrudRepository {
+
+ /*
+ * (non-Javadoc)
+ * @see org.springframework.data.repository.CrudRepository#saveAll(java.lang.Iterable)
+ */
+ @Override
+ List saveAll(Iterable entites);
+
+ /*
+ * (non-Javadoc)
+ * @see org.springframework.data.repository.CrudRepository#findAll()
+ */
+ @Override
+ List findAll();
+
+ /*
+ * (non-Javadoc)
+ * @see org.springframework.data.repository.CrudRepository#findAllById(java.lang.Iterable)
+ */
+ @Override
+ List findAllById(Iterable ids);
+
+ /**
+ * Inserts the given entity. Assumes the instance to be new to be able to apply insertion optimizations. Use the
+ * returned instance for further operations as the save operation might have changed the entity instance completely.
+ * Prefer using {@link #save(Object)} instead to avoid the usage of store-specific API.
+ *
+ * @param entity must not be {@literal null}.
+ * @return the saved entity
+ * @since 2.0
+ */
+ S insert(S entity);
+
+ /**
+ * Inserts the given entities. Assumes the given entities to have not been persisted yet and thus will optimize the
+ * insert over a call to {@link #saveAll(Iterable)}. Prefer using {@link #saveAll(Iterable)} to avoid the usage of
+ * store specific API.
+ *
+ * @param entities must not be {@literal null}.
+ * @return the saved entities
+ * @since 2.0
+ */
+ List insert(Iterable entities);
+}
diff --git a/spring-data-cassandra/src/main/java/org/springframework/data/cassandra/repository/MapIdCassandraRepository.java b/spring-data-cassandra/src/main/java/org/springframework/data/cassandra/repository/MapIdCassandraRepository.java
new file mode 100644
index 000000000..e4718a4f2
--- /dev/null
+++ b/spring-data-cassandra/src/main/java/org/springframework/data/cassandra/repository/MapIdCassandraRepository.java
@@ -0,0 +1,51 @@
+/*
+ * Copyright 2017 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.springframework.data.cassandra.repository;
+
+import org.springframework.data.cassandra.core.mapping.PrimaryKeyColumn;
+import org.springframework.data.cassandra.repository.support.BasicMapId;
+import org.springframework.data.repository.NoRepositoryBean;
+
+/**
+ * Cassandra repository interface using {@link MapId} to represent Ids.
+ *
+ * This interface uses {@link MapId} for the id type, allowing you to annotate entity fields or properties with
+ * {@link PrimaryKeyColumn @PrimaryKeyColumn}. Use this interface if you do not require a composite primary key class
+ * and want to specify the Id with {@link MapId}.
+ *
+ * Steps to use this interface:
+ *
+ *
Define your entity, including a field or property for each column, including those for partition and (optional)
+ * cluster columns.
+ *
Annotate each partition & cluster field or property with {@link PrimaryKeyColumn @PrimaryKeyColumn}
+ *
Define your repository interface to be a subinterface of this interface, which uses a provided id type,
+ * {@link MapId} (implemented by {@link BasicMapId}).
+ *
Whenever you need a {@link MapId}, you can use the static factory method {@link BasicMapId#id()} (which is
+ * convenient if you import statically) and the builder method {@link MapId#with(String, Object)} to easily construct an
+ * id.
+ *
Optionally, entity class authors can have their entities implement {@link MapIdentifiable}, to make it easier and
+ * quicker for entity clients to get the entity's identity.
+ *
+ *
+ * @author Matthew T. Adams
+ * @author Mark Paluch
+ * @since 2.0
+ * @see CassandraRepository
+ * @see MapId
+ * @see MapIdentifiable
+ */
+@NoRepositoryBean
+public interface MapIdCassandraRepository extends CassandraRepository {}
diff --git a/spring-data-cassandra/src/main/java/org/springframework/data/cassandra/repository/TypedIdCassandraRepository.java b/spring-data-cassandra/src/main/java/org/springframework/data/cassandra/repository/TypedIdCassandraRepository.java
index ece1711f7..e793df3de 100644
--- a/spring-data-cassandra/src/main/java/org/springframework/data/cassandra/repository/TypedIdCassandraRepository.java
+++ b/spring-data-cassandra/src/main/java/org/springframework/data/cassandra/repository/TypedIdCassandraRepository.java
@@ -5,7 +5,7 @@
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -15,15 +15,7 @@
*/
package org.springframework.data.cassandra.repository;
-import java.util.List;
-
-import org.springframework.data.cassandra.core.mapping.PrimaryKey;
-import org.springframework.data.cassandra.core.mapping.PrimaryKeyClass;
-import org.springframework.data.cassandra.core.mapping.PrimaryKeyColumn;
import org.springframework.data.cassandra.core.mapping.Table;
-import org.springframework.data.cassandra.repository.support.BasicMapId;
-import org.springframework.data.domain.Persistable;
-import org.springframework.data.repository.CrudRepository;
import org.springframework.data.repository.NoRepositoryBean;
/**
@@ -35,7 +27,7 @@ import org.springframework.data.repository.NoRepositoryBean;
*
annotate the field or property in your entity with {@link PrimaryKey @PrimaryKey} and declare your repository
* interface to be a subinterface of this interface, specifying the entity type and id type, or
*
annotate the field or property in your entity with {@link PrimaryKeyColumn @PrimaryKeyColumn} and declare your
- * repository interface to be a subinterface of {@link CassandraRepository}.
+ * repository interface to be a subinterface of {@link MapIdCassandraRepository}.
*
* If multiple columns comprise the identity of the entity, then you must employ one of the following two strategies.
*
@@ -49,13 +41,13 @@ import org.springframework.data.repository.NoRepositoryBean;
* your primary key class type.
*
*
Strategy: embed identity fields or properties directly in your entity and use
- * {@link CassandraRepository}
+ * {@link MapIdCassandraRepository}
*
*
Define your entity, including a field or property for each column, including those for partition and (optional)
* cluster columns.
*
Annotate each partition & cluster field or property with {@link PrimaryKeyColumn @PrimaryKeyColumn}
- *
Define your repository interface to be a subinterface of {@link CassandraRepository}, which uses a provided id
- * type, {@link MapId} (implemented by {@link BasicMapId}).
+ *
Define your repository interface to be a subinterface of {@link MapIdCassandraRepository}, which uses a provided
+ * id type, {@link MapId} (implemented by {@link BasicMapId}).
*
Whenever you need a {@link MapId}, you can use the static factory method {@link BasicMapId#id()} (which is
* convenient if you import statically) and the builder method {@link MapId#with(String, Object)} to easily construct an
* id.
@@ -65,50 +57,8 @@ import org.springframework.data.repository.NoRepositoryBean;
* @author Alex Shvid
* @author Matthew T. Adams
* @author Mark Paluch
+ * @deprecated since 2.0, use {@link CassandraRepository}.
*/
@NoRepositoryBean
-public interface TypedIdCassandraRepository extends CrudRepository {
-
- /*
- * (non-Javadoc)
- * @see org.springframework.data.repository.CrudRepository#saveAll(java.lang.Iterable)
- */
- @Override
- List saveAll(Iterable entites);
-
- /*
- * (non-Javadoc)
- * @see org.springframework.data.repository.CrudRepository#findAll()
- */
- @Override
- List findAll();
-
- /*
- * (non-Javadoc)
- * @see org.springframework.data.repository.CrudRepository#findAllById(java.lang.Iterable)
- */
- @Override
- List findAllById(Iterable ids);
-
- /**
- * Inserts the given entity. Assumes the instance to be new to be able to apply insertion optimizations. Use the
- * returned instance for further operations as the save operation might have changed the entity instance completely.
- * Prefer using {@link #save(Object)} instead to avoid the usage of store-specific API.
- *
- * @param entity must not be {@literal null}.
- * @return the saved entity
- * @since 2.0
- */
- S insert(S entity);
-
- /**
- * Inserts the given entities. Assumes the given entities to have not been persisted yet and thus will optimize the
- * insert over a call to {@link #saveAll(Iterable)}. Prefer using {@link #saveAll(Iterable)} to avoid the usage of
- * store specific API.
- *
- * @param entities must not be {@literal null}.
- * @return the saved entities
- * @since 2.0
- */
- List insert(Iterable entities);
-}
+@Deprecated
+public interface TypedIdCassandraRepository extends CassandraRepository {}
diff --git a/spring-data-cassandra/src/main/java/org/springframework/data/cassandra/repository/support/CassandraRepositoryFactory.java b/spring-data-cassandra/src/main/java/org/springframework/data/cassandra/repository/support/CassandraRepositoryFactory.java
index e0451de9f..99a4de166 100644
--- a/spring-data-cassandra/src/main/java/org/springframework/data/cassandra/repository/support/CassandraRepositoryFactory.java
+++ b/spring-data-cassandra/src/main/java/org/springframework/data/cassandra/repository/support/CassandraRepositoryFactory.java
@@ -21,7 +21,7 @@ import java.util.Optional;
import org.springframework.data.cassandra.core.CassandraOperations;
import org.springframework.data.cassandra.core.mapping.CassandraMappingContext;
import org.springframework.data.cassandra.core.mapping.CassandraPersistentEntity;
-import org.springframework.data.cassandra.repository.TypedIdCassandraRepository;
+import org.springframework.data.cassandra.repository.CassandraRepository;
import org.springframework.data.cassandra.repository.query.CassandraEntityInformation;
import org.springframework.data.cassandra.repository.query.CassandraQueryMethod;
import org.springframework.data.cassandra.repository.query.PartTreeCassandraQuery;
@@ -39,7 +39,7 @@ import org.springframework.expression.spel.standard.SpelExpressionParser;
import org.springframework.util.Assert;
/**
- * Factory to create {@link TypedIdCassandraRepository} instances.
+ * Factory to create {@link CassandraRepository} instances.
*
* @author Alex Shvid
* @author Matthew T. Adams
diff --git a/spring-data-cassandra/src/main/java/org/springframework/data/cassandra/repository/support/CassandraRepositoryFactoryBean.java b/spring-data-cassandra/src/main/java/org/springframework/data/cassandra/repository/support/CassandraRepositoryFactoryBean.java
index d9ab2f3e6..13a4384a7 100644
--- a/spring-data-cassandra/src/main/java/org/springframework/data/cassandra/repository/support/CassandraRepositoryFactoryBean.java
+++ b/spring-data-cassandra/src/main/java/org/springframework/data/cassandra/repository/support/CassandraRepositoryFactoryBean.java
@@ -16,20 +16,19 @@
package org.springframework.data.cassandra.repository.support;
import org.springframework.data.cassandra.core.CassandraTemplate;
-import org.springframework.data.cassandra.repository.TypedIdCassandraRepository;
+import org.springframework.data.cassandra.repository.CassandraRepository;
import org.springframework.data.repository.Repository;
import org.springframework.data.repository.core.support.RepositoryFactoryBeanSupport;
import org.springframework.data.repository.core.support.RepositoryFactorySupport;
import org.springframework.util.Assert;
/**
- * {@link org.springframework.beans.factory.FactoryBean} to create {@link TypedIdCassandraRepository} instances.
+ * {@link org.springframework.beans.factory.FactoryBean} to create {@link CassandraRepository} instances.
*
* @author Alex Shvid
* @author John Blum
* @author Oliver Gierke
- * @see org.springframework.data.repository.Repository
- * @see org.springframework.data.repository.core.support.RepositoryFactoryBeanSupport
+ * @author Mark Paluch
*/
public class CassandraRepositoryFactoryBean, S, ID>
extends RepositoryFactoryBeanSupport {
diff --git a/spring-data-cassandra/src/main/java/org/springframework/data/cassandra/repository/support/SimpleCassandraRepository.java b/spring-data-cassandra/src/main/java/org/springframework/data/cassandra/repository/support/SimpleCassandraRepository.java
index fb6d58756..0fb389b55 100644
--- a/spring-data-cassandra/src/main/java/org/springframework/data/cassandra/repository/support/SimpleCassandraRepository.java
+++ b/spring-data-cassandra/src/main/java/org/springframework/data/cassandra/repository/support/SimpleCassandraRepository.java
@@ -26,7 +26,7 @@ import org.springframework.data.cassandra.core.CassandraOperations;
import org.springframework.data.cassandra.core.CassandraTemplate;
import org.springframework.data.cassandra.core.convert.CassandraConverter;
import org.springframework.data.cassandra.core.mapping.CassandraPersistentEntity;
-import org.springframework.data.cassandra.repository.TypedIdCassandraRepository;
+import org.springframework.data.cassandra.repository.CassandraRepository;
import org.springframework.data.cassandra.repository.query.CassandraEntityInformation;
import org.springframework.util.Assert;
@@ -41,7 +41,7 @@ import com.datastax.driver.core.querybuilder.Select;
* @author Matthew T. Adams
* @author Mark Paluch
*/
-public class SimpleCassandraRepository implements TypedIdCassandraRepository {
+public class SimpleCassandraRepository implements CassandraRepository {
private final CassandraEntityInformation entityInformation;
diff --git a/spring-data-cassandra/src/test/java/org/springframework/data/cassandra/repository/BigIntParamIntegrationTests.java b/spring-data-cassandra/src/test/java/org/springframework/data/cassandra/repository/BigIntParamIntegrationTests.java
index 77eb43e3c..b7d7977f0 100755
--- a/spring-data-cassandra/src/test/java/org/springframework/data/cassandra/repository/BigIntParamIntegrationTests.java
+++ b/spring-data-cassandra/src/test/java/org/springframework/data/cassandra/repository/BigIntParamIntegrationTests.java
@@ -46,6 +46,7 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
* Integration tests for {@link BigInteger} usage in repositories.
*
* @author Pete Cable
+ * @author Mark Paluch
*/
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration
@@ -94,7 +95,7 @@ public class BigIntParamIntegrationTests extends AbstractSpringDataEmbeddedCassa
/**
* @author Pete Cable
*/
- interface BigThingRepo extends CassandraRepository {
+ interface BigThingRepo extends MapIdCassandraRepository {
@Query("SELECT * from bigthing where number = ?0")
BigThing findThingByBigInteger(BigInteger number);
diff --git a/spring-data-cassandra/src/test/java/org/springframework/data/cassandra/repository/DateKeyIntegrationTests.java b/spring-data-cassandra/src/test/java/org/springframework/data/cassandra/repository/DateKeyIntegrationTests.java
index e033cb107..0d2d38b72 100755
--- a/spring-data-cassandra/src/test/java/org/springframework/data/cassandra/repository/DateKeyIntegrationTests.java
+++ b/spring-data-cassandra/src/test/java/org/springframework/data/cassandra/repository/DateKeyIntegrationTests.java
@@ -96,7 +96,7 @@ public class DateKeyIntegrationTests extends AbstractSpringDataEmbeddedCassandra
*
* @author Matthew T. Adams
*/
- interface DateThingRepo extends CassandraRepository {
+ interface DateThingRepo extends MapIdCassandraRepository {
@Query("SELECT * from datething where date = ?0")
DateThing findThingByDate(Date date);
diff --git a/spring-data-cassandra/src/test/java/org/springframework/data/cassandra/repository/IntParamIntegrationTests.java b/spring-data-cassandra/src/test/java/org/springframework/data/cassandra/repository/IntParamIntegrationTests.java
index 526272d47..d137ae116 100755
--- a/spring-data-cassandra/src/test/java/org/springframework/data/cassandra/repository/IntParamIntegrationTests.java
+++ b/spring-data-cassandra/src/test/java/org/springframework/data/cassandra/repository/IntParamIntegrationTests.java
@@ -42,6 +42,7 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
/**
* @author Matthew T. Adams
+ * @author Mark Paluch
*/
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration
@@ -88,7 +89,7 @@ public class IntParamIntegrationTests extends AbstractSpringDataEmbeddedCassandr
@PrimaryKeyColumn(ordinal = 0, type = PrimaryKeyType.PARTITIONED) private int number;
}
- interface IntThingRepo extends CassandraRepository {
+ interface IntThingRepo extends MapIdCassandraRepository {
@Query("SELECT * from intthing where number = ?0")
IntThing findThingByIntPrimitive(int number);
diff --git a/spring-data-cassandra/src/test/java/org/springframework/data/cassandra/repository/NamedQueryIntegrationTests.java b/spring-data-cassandra/src/test/java/org/springframework/data/cassandra/repository/NamedQueryIntegrationTests.java
index eac184f4a..f17bd2515 100755
--- a/spring-data-cassandra/src/test/java/org/springframework/data/cassandra/repository/NamedQueryIntegrationTests.java
+++ b/spring-data-cassandra/src/test/java/org/springframework/data/cassandra/repository/NamedQueryIntegrationTests.java
@@ -339,7 +339,7 @@ public class NamedQueryIntegrationTests extends AbstractSpringDataEmbeddedCassan
assertThat(count).isEqualTo(before + 100L);
}
- public interface PersonRepositoryWithNamedQueries extends CassandraRepository {
+ public interface PersonRepositoryWithNamedQueries extends MapIdCassandraRepository {
List findFolksWithLastnameAsList(String lastname);
diff --git a/spring-data-cassandra/src/test/java/org/springframework/data/cassandra/repository/QueryDerivationIntegrationTests.java b/spring-data-cassandra/src/test/java/org/springframework/data/cassandra/repository/QueryDerivationIntegrationTests.java
index 39d46789a..05b324d6e 100644
--- a/spring-data-cassandra/src/test/java/org/springframework/data/cassandra/repository/QueryDerivationIntegrationTests.java
+++ b/spring-data-cassandra/src/test/java/org/springframework/data/cassandra/repository/QueryDerivationIntegrationTests.java
@@ -281,7 +281,7 @@ public class QueryDerivationIntegrationTests extends AbstractSpringDataEmbeddedC
/**
* @author Mark Paluch
*/
- static interface PersonRepository extends CassandraRepository {
+ static interface PersonRepository extends MapIdCassandraRepository {
List findByLastname(String lastname);
diff --git a/spring-data-cassandra/src/test/java/org/springframework/data/cassandra/repository/config/CassandraRepositoryConfigurationExtensionUnitTests.java b/spring-data-cassandra/src/test/java/org/springframework/data/cassandra/repository/config/CassandraRepositoryConfigurationExtensionUnitTests.java
index 2fbe41fba..5001c5d86 100755
--- a/spring-data-cassandra/src/test/java/org/springframework/data/cassandra/repository/config/CassandraRepositoryConfigurationExtensionUnitTests.java
+++ b/spring-data-cassandra/src/test/java/org/springframework/data/cassandra/repository/config/CassandraRepositoryConfigurationExtensionUnitTests.java
@@ -28,7 +28,7 @@ import org.springframework.core.io.ResourceLoader;
import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
import org.springframework.core.type.StandardAnnotationMetadata;
import org.springframework.data.cassandra.core.mapping.Table;
-import org.springframework.data.cassandra.repository.CassandraRepository;
+import org.springframework.data.cassandra.repository.MapIdCassandraRepository;
import org.springframework.data.repository.Repository;
import org.springframework.data.repository.config.AnnotationRepositoryConfigurationSource;
import org.springframework.data.repository.config.RepositoryConfiguration;
@@ -38,6 +38,7 @@ import org.springframework.data.repository.config.RepositoryConfigurationSource;
* Unit tests for {@link CassandraRepositoryConfigurationExtension}.
*
* @author Christoph Strobl
+ * @author Mark Paluch
*/
public class CassandraRepositoryConfigurationExtensionUnitTests {
@@ -108,5 +109,5 @@ public class CassandraRepositoryConfigurationExtensionUnitTests {
interface UnannotatedRepository extends Repository