DATACASS-452 - Align naming scheme for CassandraRepository.
We now follow a more consistent naming scheme for cassandra repository interfaces. * The basic, store-specific interface is now named CassandraRepository * An extended variant, using MapId's is named MapIdCassandraRepository That results in the following renames: * CassandraRepository -> MapIdCassandraRepository * TypedIdCassandraRepository -> CassandraRepository TypedIdCassandraRepository was re-introduced as deprecated variant now extending CassandraRepository to preserve a majority of existing repository declarations.
This commit is contained in:
@@ -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.
|
||||
* <p/>
|
||||
* 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}.
|
||||
* <p/>
|
||||
* Steps to use this interface:
|
||||
* <ul>
|
||||
* <li>Define your entity, including a field or property for each column, including those for partition and (optional)
|
||||
* cluster columns.</li>
|
||||
* <li>Annotate each partition & cluster field or property with {@link PrimaryKeyColumn @PrimaryKeyColumn}</li>
|
||||
* <li>Define your repository interface to be a subinterface of this interface, which uses a provided id type,
|
||||
* {@link MapId} (implemented by {@link BasicMapId}).</li>
|
||||
* <li>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.</li>
|
||||
* <li>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.</li>
|
||||
* </ul>
|
||||
* 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.
|
||||
* <p />
|
||||
* 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 <T> 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<T> extends TypedIdCassandraRepository<T, MapId> {}
|
||||
public interface CassandraRepository<T, ID> extends CrudRepository<T, ID> {
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see org.springframework.data.repository.CrudRepository#saveAll(java.lang.Iterable)
|
||||
*/
|
||||
@Override
|
||||
<S extends T> List<S> saveAll(Iterable<S> entites);
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see org.springframework.data.repository.CrudRepository#findAll()
|
||||
*/
|
||||
@Override
|
||||
List<T> findAll();
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see org.springframework.data.repository.CrudRepository#findAllById(java.lang.Iterable)
|
||||
*/
|
||||
@Override
|
||||
List<T> findAllById(Iterable<ID> 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 extends T> 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
|
||||
*/
|
||||
<S extends T> List<S> insert(Iterable<S> entities);
|
||||
}
|
||||
|
||||
@@ -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.
|
||||
* <p/>
|
||||
* 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}.
|
||||
* <p/>
|
||||
* Steps to use this interface:
|
||||
* <ul>
|
||||
* <li>Define your entity, including a field or property for each column, including those for partition and (optional)
|
||||
* cluster columns.</li>
|
||||
* <li>Annotate each partition & cluster field or property with {@link PrimaryKeyColumn @PrimaryKeyColumn}</li>
|
||||
* <li>Define your repository interface to be a subinterface of this interface, which uses a provided id type,
|
||||
* {@link MapId} (implemented by {@link BasicMapId}).</li>
|
||||
* <li>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.</li>
|
||||
* <li>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.</li>
|
||||
* </ul>
|
||||
*
|
||||
* @author Matthew T. Adams
|
||||
* @author Mark Paluch
|
||||
* @since 2.0
|
||||
* @see CassandraRepository
|
||||
* @see MapId
|
||||
* @see MapIdentifiable
|
||||
*/
|
||||
@NoRepositoryBean
|
||||
public interface MapIdCassandraRepository<T> extends CassandraRepository<T, MapId> {}
|
||||
@@ -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;
|
||||
* <li>annotate the field or property in your entity with {@link PrimaryKey @PrimaryKey} and declare your repository
|
||||
* interface to be a subinterface of <em>this</em> interface, specifying the entity type and id type, or</li>
|
||||
* <li>annotate the field or property in your entity with {@link PrimaryKeyColumn @PrimaryKeyColumn} and declare your
|
||||
* repository interface to be a subinterface of {@link CassandraRepository}.</li>
|
||||
* repository interface to be a subinterface of {@link MapIdCassandraRepository}.</li>
|
||||
* </ul>
|
||||
* If multiple columns comprise the identity of the entity, then you must employ one of the following two strategies.
|
||||
* <ul>
|
||||
@@ -49,13 +41,13 @@ import org.springframework.data.repository.NoRepositoryBean;
|
||||
* your primary key class type.</li>
|
||||
* </ul>
|
||||
* <li><em>Strategy: embed identity fields or properties directly in your entity and use
|
||||
* {@link CassandraRepository}</em></li>
|
||||
* {@link MapIdCassandraRepository}</em></li>
|
||||
* <ul>
|
||||
* <li>Define your entity, including a field or property for each column, including those for partition and (optional)
|
||||
* cluster columns.</li>
|
||||
* <li>Annotate each partition & cluster field or property with {@link PrimaryKeyColumn @PrimaryKeyColumn}</li>
|
||||
* <li>Define your repository interface to be a subinterface of {@link CassandraRepository}, which uses a provided id
|
||||
* type, {@link MapId} (implemented by {@link BasicMapId}).</li>
|
||||
* <li>Define your repository interface to be a subinterface of {@link MapIdCassandraRepository}, which uses a provided
|
||||
* id type, {@link MapId} (implemented by {@link BasicMapId}).</li>
|
||||
* <li>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.</li>
|
||||
@@ -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<T, ID> extends CrudRepository<T, ID> {
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see org.springframework.data.repository.CrudRepository#saveAll(java.lang.Iterable)
|
||||
*/
|
||||
@Override
|
||||
<S extends T> List<S> saveAll(Iterable<S> entites);
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see org.springframework.data.repository.CrudRepository#findAll()
|
||||
*/
|
||||
@Override
|
||||
List<T> findAll();
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see org.springframework.data.repository.CrudRepository#findAllById(java.lang.Iterable)
|
||||
*/
|
||||
@Override
|
||||
List<T> findAllById(Iterable<ID> 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 extends T> 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
|
||||
*/
|
||||
<S extends T> List<S> insert(Iterable<S> entities);
|
||||
}
|
||||
@Deprecated
|
||||
public interface TypedIdCassandraRepository<T, ID> extends CassandraRepository<T, ID> {}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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<T extends Repository<S, ID>, S, ID>
|
||||
extends RepositoryFactoryBeanSupport<T, S, ID> {
|
||||
|
||||
@@ -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<T, ID> implements TypedIdCassandraRepository<T, ID> {
|
||||
public class SimpleCassandraRepository<T, ID> implements CassandraRepository<T, ID> {
|
||||
|
||||
private final CassandraEntityInformation<T, ID> entityInformation;
|
||||
|
||||
|
||||
@@ -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<BigThing> {
|
||||
interface BigThingRepo extends MapIdCassandraRepository<BigThing> {
|
||||
|
||||
@Query("SELECT * from bigthing where number = ?0")
|
||||
BigThing findThingByBigInteger(BigInteger number);
|
||||
|
||||
@@ -96,7 +96,7 @@ public class DateKeyIntegrationTests extends AbstractSpringDataEmbeddedCassandra
|
||||
*
|
||||
* @author Matthew T. Adams
|
||||
*/
|
||||
interface DateThingRepo extends CassandraRepository<DateThing> {
|
||||
interface DateThingRepo extends MapIdCassandraRepository<DateThing> {
|
||||
|
||||
@Query("SELECT * from datething where date = ?0")
|
||||
DateThing findThingByDate(Date date);
|
||||
|
||||
@@ -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<IntThing> {
|
||||
interface IntThingRepo extends MapIdCassandraRepository<IntThing> {
|
||||
|
||||
@Query("SELECT * from intthing where number = ?0")
|
||||
IntThing findThingByIntPrimitive(int number);
|
||||
|
||||
@@ -339,7 +339,7 @@ public class NamedQueryIntegrationTests extends AbstractSpringDataEmbeddedCassan
|
||||
assertThat(count).isEqualTo(before + 100L);
|
||||
}
|
||||
|
||||
public interface PersonRepositoryWithNamedQueries extends CassandraRepository<Person> {
|
||||
public interface PersonRepositoryWithNamedQueries extends MapIdCassandraRepository<Person> {
|
||||
|
||||
List<Person> findFolksWithLastnameAsList(String lastname);
|
||||
|
||||
|
||||
@@ -281,7 +281,7 @@ public class QueryDerivationIntegrationTests extends AbstractSpringDataEmbeddedC
|
||||
/**
|
||||
* @author Mark Paluch
|
||||
*/
|
||||
static interface PersonRepository extends CassandraRepository<Person> {
|
||||
static interface PersonRepository extends MapIdCassandraRepository<Person> {
|
||||
|
||||
List<Person> findByLastname(String lastname);
|
||||
|
||||
|
||||
@@ -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<Object, Long> {}
|
||||
|
||||
interface StoreRepository extends CassandraRepository<Object> {}
|
||||
interface StoreRepository extends MapIdCassandraRepository<Object> {}
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ import java.util.List;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.cassandra.repository.CassandraRepository;
|
||||
import org.springframework.data.cassandra.repository.MapIdCassandraRepository;
|
||||
import org.springframework.data.cassandra.repository.NamedQueryIntegrationTests.PersonRepositoryWithNamedQueries;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
@@ -99,7 +99,7 @@ public class DerivedQueryMethodsParameterConversionIntegrationTests extends Para
|
||||
assertThat(contactRepository.findByAlternativePhonesContains(udtValue)).contains(walter);
|
||||
}
|
||||
|
||||
interface ContactRepository extends CassandraRepository<Contact> {
|
||||
interface ContactRepository extends MapIdCassandraRepository<Contact> {
|
||||
|
||||
List<Contact> findByAddress(Address address);
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ import java.util.List;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.cassandra.repository.CassandraRepository;
|
||||
import org.springframework.data.cassandra.repository.MapIdCassandraRepository;
|
||||
import org.springframework.data.cassandra.repository.NamedQueryIntegrationTests.PersonRepositoryWithNamedQueries;
|
||||
import org.springframework.data.cassandra.repository.Query;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
@@ -100,7 +100,7 @@ public class StringQueryMethodsParameterConversionIntegrationTests extends Param
|
||||
assertThat(contactRepository.findByAlternativePhonesContains(udtValue)).contains(walter);
|
||||
}
|
||||
|
||||
interface ContactStringQueryRepository extends CassandraRepository<Contact> {
|
||||
interface ContactStringQueryRepository extends MapIdCassandraRepository<Contact> {
|
||||
|
||||
@Query("SELECT * from contact where address = ?0;")
|
||||
List<Contact> findByAddress(Address address);
|
||||
|
||||
@@ -38,7 +38,7 @@ import org.springframework.data.cassandra.core.mapping.UserTypeResolver;
|
||||
import org.springframework.data.cassandra.domain.AddressType;
|
||||
import org.springframework.data.cassandra.domain.Group;
|
||||
import org.springframework.data.cassandra.domain.Person;
|
||||
import org.springframework.data.cassandra.repository.CassandraRepository;
|
||||
import org.springframework.data.cassandra.repository.MapIdCassandraRepository;
|
||||
import org.springframework.data.cassandra.repository.Query;
|
||||
import org.springframework.data.cql.core.CqlIdentifier;
|
||||
import org.springframework.data.projection.ProjectionFactory;
|
||||
@@ -197,13 +197,13 @@ public class PartTreeCassandraQueryUnitTests {
|
||||
}
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
interface GroupRepository extends CassandraRepository<Group> {
|
||||
interface GroupRepository extends MapIdCassandraRepository<Group> {
|
||||
|
||||
Group findByIdHashPrefix(String hashPrefix);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
interface Repo extends CassandraRepository<Person> {
|
||||
interface Repo extends MapIdCassandraRepository<Person> {
|
||||
|
||||
@Query()
|
||||
Person findByLastname(String lastname);
|
||||
|
||||
@@ -36,7 +36,7 @@ import org.springframework.data.cassandra.core.convert.MappingCassandraConverter
|
||||
import org.springframework.data.cassandra.core.mapping.BasicCassandraMappingContext;
|
||||
import org.springframework.data.cassandra.core.mapping.UserTypeResolver;
|
||||
import org.springframework.data.cassandra.domain.Person;
|
||||
import org.springframework.data.cassandra.repository.CassandraRepository;
|
||||
import org.springframework.data.cassandra.repository.MapIdCassandraRepository;
|
||||
import org.springframework.data.cassandra.repository.Query;
|
||||
import org.springframework.data.projection.ProjectionFactory;
|
||||
import org.springframework.data.projection.SpelAwareProxyProjectionFactory;
|
||||
@@ -127,7 +127,7 @@ public class ReactivePartTreeCassandraQueryUnitTests {
|
||||
}
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
interface Repo extends CassandraRepository<Person> {
|
||||
interface Repo extends MapIdCassandraRepository<Person> {
|
||||
|
||||
@Query()
|
||||
Flux<Person> findByLastname(String lastname);
|
||||
|
||||
@@ -32,7 +32,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.data.cassandra.core.CassandraOperations;
|
||||
import org.springframework.data.cassandra.domain.User;
|
||||
import org.springframework.data.cassandra.repository.TypedIdCassandraRepository;
|
||||
import org.springframework.data.cassandra.repository.CassandraRepository;
|
||||
import org.springframework.data.cql.AbstractKeyspaceCreatingIntegrationTest;
|
||||
import org.springframework.data.repository.query.DefaultEvaluationContextProvider;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
@@ -288,5 +288,5 @@ public class SimpleCassandraRepositoryIntegrationTests extends AbstractKeyspaceC
|
||||
assertThat(loaded).isEmpty();
|
||||
}
|
||||
|
||||
interface UserRepostitory extends TypedIdCassandraRepository<User, String> {}
|
||||
interface UserRepostitory extends CassandraRepository<User, String> {}
|
||||
}
|
||||
|
||||
@@ -15,9 +15,10 @@
|
||||
*/
|
||||
package org.springframework.data.cassandra.test.integration.forcequote.compositeprimarykey;
|
||||
|
||||
import org.springframework.data.cassandra.repository.TypedIdCassandraRepository;
|
||||
import org.springframework.data.cassandra.repository.CassandraRepository;
|
||||
|
||||
/**
|
||||
* @author Matthew T. Adams
|
||||
* @author Mark Paluch
|
||||
*/
|
||||
public interface ExplicitRepository extends TypedIdCassandraRepository<Explicit, ExplicitKey> {}
|
||||
public interface ExplicitRepository extends CassandraRepository<Explicit, ExplicitKey> {}
|
||||
|
||||
@@ -15,9 +15,10 @@
|
||||
*/
|
||||
package org.springframework.data.cassandra.test.integration.forcequote.compositeprimarykey;
|
||||
|
||||
import org.springframework.data.cassandra.repository.TypedIdCassandraRepository;
|
||||
import org.springframework.data.cassandra.repository.CassandraRepository;
|
||||
|
||||
/**
|
||||
* @author Matthew T. Adams
|
||||
* @author Mark Paluch
|
||||
*/
|
||||
public interface ImplicitRepository extends TypedIdCassandraRepository<Implicit, ImplicitKey> {}
|
||||
public interface ImplicitRepository extends CassandraRepository<Implicit, ImplicitKey> {}
|
||||
|
||||
@@ -15,9 +15,10 @@
|
||||
*/
|
||||
package org.springframework.data.cassandra.test.integration.forcequote.config;
|
||||
|
||||
import org.springframework.data.cassandra.repository.TypedIdCassandraRepository;
|
||||
import org.springframework.data.cassandra.repository.CassandraRepository;
|
||||
|
||||
/**
|
||||
* @author Matthew T. Adams
|
||||
* @author Mark Paluch
|
||||
*/
|
||||
public interface ExplicitPropertiesRepository extends TypedIdCassandraRepository<ExplicitProperties, String> {}
|
||||
public interface ExplicitPropertiesRepository extends CassandraRepository<ExplicitProperties, String> {}
|
||||
|
||||
@@ -15,9 +15,10 @@
|
||||
*/
|
||||
package org.springframework.data.cassandra.test.integration.forcequote.config;
|
||||
|
||||
import org.springframework.data.cassandra.repository.TypedIdCassandraRepository;
|
||||
import org.springframework.data.cassandra.repository.CassandraRepository;
|
||||
|
||||
/**
|
||||
* @author Matthew T. Adams
|
||||
* @author Mark Paluch
|
||||
*/
|
||||
public interface ExplicitRepository extends TypedIdCassandraRepository<Explicit, String> {}
|
||||
public interface ExplicitRepository extends CassandraRepository<Explicit, String> {}
|
||||
|
||||
@@ -15,9 +15,10 @@
|
||||
*/
|
||||
package org.springframework.data.cassandra.test.integration.forcequote.config;
|
||||
|
||||
import org.springframework.data.cassandra.repository.TypedIdCassandraRepository;
|
||||
import org.springframework.data.cassandra.repository.CassandraRepository;
|
||||
|
||||
/**
|
||||
* @author Matthew T. Adams
|
||||
* @author Mark Paluch
|
||||
*/
|
||||
public interface ImplicitPropertiesRepository extends TypedIdCassandraRepository<ImplicitProperties, String> {}
|
||||
public interface ImplicitPropertiesRepository extends CassandraRepository<ImplicitProperties, String> {}
|
||||
|
||||
@@ -15,9 +15,10 @@
|
||||
*/
|
||||
package org.springframework.data.cassandra.test.integration.forcequote.config;
|
||||
|
||||
import org.springframework.data.cassandra.repository.TypedIdCassandraRepository;
|
||||
import org.springframework.data.cassandra.repository.CassandraRepository;
|
||||
|
||||
/**
|
||||
* @author Matthew T. Adams
|
||||
* @author Mark Paluch
|
||||
*/
|
||||
public interface ImplicitRepository extends TypedIdCassandraRepository<Implicit, String> {}
|
||||
public interface ImplicitRepository extends CassandraRepository<Implicit, String> {}
|
||||
|
||||
@@ -15,9 +15,10 @@
|
||||
*/
|
||||
package org.springframework.data.cassandra.test.integration.mapping.mapid.repo;
|
||||
|
||||
import org.springframework.data.cassandra.repository.CassandraRepository;
|
||||
import org.springframework.data.cassandra.repository.MapIdCassandraRepository;
|
||||
|
||||
/**
|
||||
* @author Matthew T. Adams
|
||||
* @author Mark Paluch
|
||||
*/
|
||||
public interface MultiPrimaryKeyColumnsRepository extends CassandraRepository<MultiPrimaryKeyColumns> {}
|
||||
public interface MultiPrimaryKeyColumnsRepository extends MapIdCassandraRepository<MultiPrimaryKeyColumns> {}
|
||||
|
||||
@@ -15,9 +15,9 @@
|
||||
*/
|
||||
package org.springframework.data.cassandra.test.integration.mapping.mapid.repo;
|
||||
|
||||
import org.springframework.data.cassandra.repository.CassandraRepository;
|
||||
import org.springframework.data.cassandra.repository.MapIdCassandraRepository;
|
||||
|
||||
/**
|
||||
* @author Matthew T. Adams
|
||||
*/
|
||||
public interface SinglePrimaryKecColumnRepository extends CassandraRepository<SinglePrimaryKeyColumn> {}
|
||||
public interface SinglePrimaryKecColumnRepository extends MapIdCassandraRepository<SinglePrimaryKeyColumn> {}
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
[[new-features.2-0-0]]
|
||||
== What's new in Spring Data for Apache Cassandra 2.0
|
||||
* `Update` and `Query` objects.
|
||||
* CRUD repository interface renaming: `CassandraRepository` using `MapId` is now renamed to `MapIdCassandraRepository`. `TypedIdCassandraRepository` is renamed to `CassandraRepository`.
|
||||
|
||||
[[new-features.1-5-0]]
|
||||
== What's new in Spring Data for Apache Cassandra 1.5
|
||||
|
||||
Reference in New Issue
Block a user