Commit Graph

898 Commits

Author SHA1 Message Date
Mark Paluch
4115cd3ca2 DATACASS-489 - Document SessionFactory in reference docs. 2017-09-13 08:41:14 -07:00
John Blum
018aea1288 DATACASS-56 - Polish. 2017-09-11 23:34:44 -07:00
Mark Paluch
90bfa5317b DATACASS-56 - Cassandra paging support.
We now support forward-only paging with Cassandra through the Template API and Repositories. Results in Cassandra are paged by navigating forward-only through pages described by a binary paging state encapsulated by CassandraPageRequest and accessible via the returned Slice. Spring Data Page's do not fit to Cassandra's paging concept because Cassandra paging is not based on limit/offset.

Page requests are applicable to a Query and as parameter of query methods.

Query query = Query.empty().pageRequest(CassandraPageRequest.first(10));
Slice<User> slice = template.slice(query, User.class);

do {

    // consume slice

    if (slice.hasNext()) {
        slice = template.select(query, slice.nextPageable(), User.class);
    } else {
        break;
    }
} while (!slice.getContent().isEmpty());

assertThat(ids).hasSize(100);
assertThat(iterations).isEqualTo(10);

interface UserRepository implements Repository<User, String> {

    Slice<User> findAllByName(String name, Pageable pageRequest);
}
2017-09-11 23:22:43 -07:00
Mark Paluch
62e6d33314 DATACASS-56 - Allow query options mutation.
We now allow query option mutation through QueryOptions.mutate() returning an initialized builder. The mutation builder is initialized with the state of the QueryOptions object and allows further customization without changing the previous state of the immutable QueryOptions object.

QueryOptions queryOptions = …;

QueryOptions mutated = queryOptions.mutate().readTimeout(Duration.ofSeconds(5)).build();
2017-09-11 23:14:43 -07:00
John Blum
1cb5a8bd99 DATACASS-146 - Polish. 2017-09-11 23:14:09 -07:00
Mark Paluch
0ee5190f09 DATACASS-146 - Enhance Repository methods to accept QueryOptions as arguments.
We now support Repository query methods with query options. Query options can be passed either as an additional parameter to a Repository query method or applied with annotation.
Annotation-based query options are supported via @Consistency. A query options parameter has precedence over the annotation if a method declares both, an annotation-based consistency level and accepts a query options parameter.

interface SampleRepository extends Repository<Person, String> {

  @Query("SELECT * FROM person WHERE lastname = ?0;")
  @Consistency(ConsistencyLevel.LOCAL_ONE)
  Person findByLastname(String lastname);

  @Consistency(ConsistencyLevel.LOCAL_ONE)
  Person findByAge(int age);

  Person findByAge(int age, QueryOptions options);
}

SampleRepository repository = …;

repository.findByAge(42, QueryOptions.builder().fetchSize(44).build());
2017-09-11 23:14:00 -07:00
John Blum
d00ff35b19 DATACASS-145 - Polish. 2017-09-11 18:11:46 -07:00
Mark Paluch
997888678a DATACASS-145 - Make SimpleCassandraRepository.createInsert(…) protected.
Expose createInsert(…) in the synchronous and reactive repository base classes to simplify base class extension. Derived classes are no longer required to implement createInsert(…) themselves but can reuse the existing methods. Extract createInsert(…) body to InsertUtil.
2017-09-11 18:11:38 -07:00
John Blum
9fc7cd9eaa DATACASS-467 - Polish. 2017-09-11 16:30:18 -07:00
Mark Paluch
58e7bcc36d DATACASS-467 - Add migration guide describing upgrade paths from 1.5 to 2.0. 2017-09-11 16:29:21 -07:00
Mark Paluch
7e6556e3bd DATACASS-467 - Update documentation. 2017-09-11 16:29:06 -07:00
Oliver Gierke
e084ec2efd DATACASS-480 - After release cleanups. 2017-09-11 17:40:21 +02:00
Oliver Gierke
1cf3595b6b DATACASS-480 - Prepare next development iteration. 2017-09-11 17:40:18 +02:00
Oliver Gierke
bdbcb3565b DATACASS-480 - Release version 2.0 RC3 (Kay). 2017-09-11 17:24:45 +02:00
Oliver Gierke
8aa59ff4a2 DATACASS-480 - Prepare 2.0 RC3 (Kay). 2017-09-11 17:23:52 +02:00
Oliver Gierke
6dc6421076 DATACASS-480 - Updated changelog. 2017-09-11 17:23:44 +02:00
Mark Paluch
e53972880a DATACASS-481 - Updated changelog. 2017-09-11 12:43:51 +02:00
Mark Paluch
759ef416ed DATACASS-490 - Switch to VM-based TravisCI build.
We now switched to VM-based builds by requiring sudo to apply higher memory limits as we exceeded memory limits of the container-based build.
2017-09-05 09:46:35 +02:00
Mark Paluch
183c502f7e DATACASS-128 - Add tests to verify simple type mapping.
Add tests that verify Java class to Cassandra type mapping for simple types that are supported natively by the driver.

Related tickets: DATACASS-271, DATACASS-280, DATACASS-375.
2017-08-30 10:45:52 +02:00
Mark Paluch
b8192424eb DATACASS-488 - Add explicit type mappings for Name.VARCHAR and Name.TEXT.
We map varchar and text types explicitly to data types to ensure resolution to the appropriate data type if queried by name. The driver returns only text via DataType.allPrimitiveTypes() because text and varchar are aliases and allPrimitiveTypes returns a set.
2017-08-04 09:34:24 +02:00
Mark Paluch
57f4c38073 DATACASS-486 - Polishing.
Fix javadoc in synchronous/asynchronous CQL operations.
2017-08-04 08:52:57 +02:00
Mark Paluch
34af38b15f DATACASS-486 - Use unique property names in UDT reference documentation example. 2017-08-04 08:52:57 +02:00
Mark Paluch
7dc3364d8e DATACASS-482 - Polishing.
Reduce method visibility on protected types. Remove deprecated methods. Formatting, reorder methods, Javadoc.

Introduce CqlIdentifier.of(…) and KeyspaceIdentifier.of(…) methods and deprecate CqlIdentifier.cqlId(…) and KeyspaceIdentifier.ksId(…) methods.
2017-08-02 10:17:49 +02:00
Mark Paluch
df045de2fa DATACASS-482 - Refactor KeyspaceActionSpecificationBean to produce KeyspaceActions.
Remove indirection via MultiLevelSetFlattenerFactoryBean and create a KeyspaceActions wrapper that encapsulates the actual actions. Introduce KeyspaceActionSpecificationFactory for keyspace action creation.
2017-08-02 10:17:49 +02:00
Mark Paluch
88d7bb231a DATACASS-482 - Introduce KeyspaceSpecifications factory methods.
Encapsulate required KeyspaceSpecification properties in immutable base classes. Introduce static factory methods to create value objects where possible. Rewrite Javadoc to reflect the nature of configuration objects and not builders since these objects to not build a target object. Refactor duplicate code into utility classes.
2017-08-02 10:17:49 +02:00
Mark Paluch
94d6a3ddc7 DATACASS-482 - Introduce usage of nullable annotations for API validation.
Mark all packages with Spring Frameworks @NonNullApi. Add Spring's @Nullable to methods, parameters and fields that take or produce null values. Adapted using code to make sure the IDE can evaluate the null flow properly. Fix Javadoc in places where an invalid null handling policy was advertised. Strengthened null requirements for types that expose null-instances.

Encapsulate KeyspaceIdentifier and CqlIdentifier with static factory methods to avoid temporary null state of fields.

Require non-null QueryOptions and provide empty option instances. Introduce methods returning non-null values (getRequired…()) for code paths known to operate on values that are available.
2017-08-02 10:17:49 +02:00
Mark Paluch
14a5f9f41b DATACASS-483 - Polishing.
Replace explicit type arguments with diamond syntax. Use Collections.empty…() instead of Collections.EMPTY_…
2017-08-02 10:17:49 +02:00
Mark Paluch
de343e2d6c DATACASS-483 - Add @FunctionalInterface to functional interfaces. 2017-08-02 10:17:48 +02:00
Oliver Gierke
ad8eb9a989 DATACASS-477 - Updated changelog. 2017-07-27 00:48:52 +02:00
Oliver Gierke
9711a45d98 DATACASS-478 - After release cleanups. 2017-07-25 16:10:38 +02:00
Oliver Gierke
044adb0635 DATACASS-478 - Prepare next development iteration. 2017-07-25 16:10:33 +02:00
Oliver Gierke
0918075327 DATACASS-478 - Release version 2.0 RC2 (Kay). 2017-07-25 15:34:23 +02:00
Oliver Gierke
9800c953e5 DATACASS-478 - Prepare 2.0 RC2 (Kay). 2017-07-25 15:33:32 +02:00
Oliver Gierke
115a930b4a DATACASS-478 - Updated changelog. 2017-07-25 15:33:20 +02:00
Mark Paluch
9d73a0db5c DATACASS-479 - Polishing.
Use domain type via ResultProcessor as input type for PartTree instead of EntityInformation.
2017-07-25 14:02:56 +02:00
Mark Paluch
16790dc4a0 DATACASS-479 - Return domain type if projection type is an interface.
We now return the domain type via CassandraQueryMethod.getEntityInformation() for query derivation. Previously, interface types were returned and they were used as input type for query derivation. Query methods referencing domain type properties that do not exist on the projection type caused PropertyReferenceException.
2017-07-25 13:59:53 +02:00
Oliver Gierke
42b2a42db9 DATACASS-464 - After release cleanups. 2017-07-25 10:00:08 +02:00
Oliver Gierke
11297949f3 DATACASS-464 - Prepare next development iteration. 2017-07-25 10:00:03 +02:00
Oliver Gierke
4b483a24b5 DATACASS-464 - Release version 2.0 RC1 (Kay). 2017-07-25 09:48:48 +02:00
Oliver Gierke
ea70bdbf36 DATACASS-464 - Prepare 2.0 RC1 (Kay). 2017-07-25 09:48:01 +02:00
Oliver Gierke
1592e5cfc5 DATACASS-464 - Updated changelog. 2017-07-25 09:47:49 +02:00
Oliver Gierke
e65b026cb0 DATACASS-461 - Updated changelog. 2017-07-24 22:20:37 +02:00
John Blum
5b44fd0962 DATACASS-213, DATACASS-306 - Polish.
Resolves PR #111.
2017-07-23 22:14:31 -07:00
Mark Paluch
9d3e12e3c4 DATACASS-306 - Create SASI indexes for annotated properties.
We now create SASI (SSTable Attached Secondary Index) indexes during session initialization for properties annotated with @SASI. Properties can be annotated with analyzer-annotations to configure analyzers.

@Table
public class Person {

		@Id String id;

		@SASI String names;

    @SASI @StandardAnalyzed(value = "de",
                enableStemming = true, normalization = Normalization.UPPERCASE,
                skipStopWords = true) String profession;

		@SASI @NonTokenizingAnalyzed String country;
}
2017-07-23 22:02:27 -07:00
Mark Paluch
4a0abd0f66 DATACASS-213 - Create secondary indexes for annotated properties.
We now create secondary indexes for annotated properties via @Indexed. Index creation is part of schema creation that is executed after Session initialization and table creation.

We support plain secondary indexes and key/value/entry indexes for map columns. Index creation is useful for rapid development but should not be used in large setups or at least with care to not impact performance in a negative way.

@Table
public class Person {

  @Id
  private String key;

  @Indexed("name_index")
  private String name;

  private Map<@Indexed String, String> keys;
}
2017-07-23 22:02:20 -07:00
Mark Paluch
c39cc959bf DATACASS-476 - Inherit Project Reactor version from dependency management.
Adapt to BOM import in Spring Data Build pom.
2017-07-20 11:14:15 +02:00
Mark Paluch
ac0d34fe2c DATACASS-362 - Add tests to assert composite key usage in …ById template methods.
Extend Javadoc to mention the accepted Id types. Add tests to verify query creation via MappingCassandraConverter.
2017-07-19 10:50:44 +02:00
Mark Paluch
ca501ba936 DATACASS-469 - Remove CassandraOperations.selectBySimpleIds(…).
We no longer expose selectBySimpleIds(…) via CassandraOperations. selectBySimpleIds was a limited short-cut method that create a SELECT statement using the primary key name and using Id values as-is without applying type conversions. The replacement is to use a select(…) method accepting Query and an appropriate query:

select(query(where("id")).in("key", "other-key"), Person.class)

assuming the primary key property is id.
2017-07-18 15:43:22 +02:00
Mark Paluch
eb9def7a4c DATACASS-451 - Adapt to deprecated RxJava 1 CRUD repositories.
Move off RxJava1CrudRepository as base repository in tests by extending just Repository and declaring query methods/overloads using RxJava1 types.
2017-07-18 14:00:43 +02:00
Mark Paluch
1db32834e1 DATACASS-468 - Polishing.
Increase CassandraRepositoryConfigurationExtension visibility as this class is required by configuration infrastructure that configures Cassandra repository support such as Spring Boot.

Initialize MappingCassandraConverter with generic custom conversions and resolve package cycle between mapping and convert by initializing MappingCassandraConverter with generic custom conversions. Cassandra-specific custom conversions require external wiring via configuration.

Move IdInterfaceValidator to mapping package to resolve the final cycle between mapping and repository.support.
2017-07-18 13:31:43 +02:00