Commit Graph

945 Commits

Author SHA1 Message Date
Mark Paluch
511ae51208 DATACASS-284 - Documentation. 2018-02-02 12:59:28 -08:00
Mark Paluch
649f2d7d08 DATACASS-284 - Add support for TupleValue.
We now support TupleValue as simple Cassandra type within domain objects along with table schema generation. Tuple columns must be annotated with @CassandraType to derive the according Cassandra column type for schema generation.

@Table
class Person {

  @Id
  String id;

  @CassandraType(type = Name.TUPLE, typeArguments = { Name.VARCHAR, Name.BIGINT })
  TupleValue tupleValue;
}
2018-02-02 12:58:50 -08:00
John Blum
3a14cb411d DATACASS-485 - Polish documentation. 2018-02-01 23:07:01 -08:00
John Blum
41eaa3a90c DATACASS-485 - Rename all test classes to XxxIntegrationTests in order to be picked up by the build. 2018-02-01 23:06:53 -08:00
John Blum
e3efe92c7f DATACASS-485 - Polish reactive, fluent Cassandra API. 2018-02-01 23:06:46 -08:00
John Blum
1197805d1b DATACASS-485 - Polish imperative, fluent Cassandra API. 2018-02-01 23:06:38 -08:00
John Blum
dec4de6da2 DATACASS-522 - Polish. 2018-02-01 23:06:31 -08:00
Mark Paluch
9fb3554f56 DATACASS-485 - Documentation. 2018-02-01 23:06:22 -08:00
Mark Paluch
81326e43a5 DATACASS-485 - Reactive Fluent Cassandra API. 2018-02-01 23:06:14 -08:00
Mark Paluch
1a3314a650 DATACASS-485 - Imperative Fluent Cassandra API.
We now provide an alternative API for CassandraOperations that allows defining operations in a fluent way. FluentCassandraOperations reduces the number of methods and strips down the interface to a minimum while offering a more readable API.

// select with filter query and projecting return type
template.query(Person.class)
    .as(Jedi.class)
    .matching(query(where("firstname").is("luke")))
    .all();

// insert
template.insert(Person.class)
    .inTable(STAR_WARS)
    .one(luke);

// update
template.update(Person.class)
    .apply(update("firstname", "Han"))
    .matching(query(where("id").is("han-solo")))
    .all();

// remove all matching
template.delete(Jedi.class)
    .inTable(STAR_WARS)
    .matching(query(where("name").is("luke")))
    .all();
2018-02-01 23:06:08 -08:00
Mark Paluch
7411dfee55 DATACASS-522 - Allow for conditionally dropping a table iff the table exists. 2018-02-01 23:06:01 -08:00
Mark Paluch
f6f8da97ca DATACASS-515 - Updated changelog. 2018-01-24 13:41:19 +01:00
Mark Paluch
15fc3669aa DATACASS-514 - Updated changelog. 2018-01-24 12:22:06 +01:00
John Blum
c00e3f6b29 DATACASS-512 - Polish.
Resolves #PR-118.
2018-01-23 17:19:17 -08:00
Mark Paluch
c0b9479599 DATACASS-512 - Support exists and count projections.
We now support exists and count projections derived from query methods and on Template API level.

Exists queries fetch rows limiting to a single row to optimize fetching.

Exists queries also support count results, i.e. a single row with a single numeric column is considered a count result. It's evaluated by comparing the number being greater to zero.

boolean exists = template.exists(Query.query(where("firstname").is("Walter")), Person.class);

long count = template.count(Query.query(where("lastname").is("White")), Person.class);

interface PersonRepository extends Repository<Person, String> {

    long countByLastname(String lastname); // derived query

    boolean existsByLastname(String lastname);  // derived query

    @CountQuery("SELECT COUNT(*) from users WHERE lastname = ?0")
    long countQueryByLastname(String lastname); // String-based query

    @ExistsQuery("SELECT * from users WHERE lastname = ?0 LIMIT 1")
    boolean existsQueryByLastname(String lastname);  // String-based query
}

Remove superfluous throws declarations.
2018-01-23 17:15:43 -08:00
Mark Paluch
4538b2aa56 DATACASS-518 - Polishing.
Simplify unit tests by inlining tests into tests class and removing nested test enclosure classes.
2018-01-18 11:39:00 +01:00
Mark Paluch
3eedafb3e4 DATACASS-518 - Polishing.
Add convenience method to table specifications accepting String column names with ordering.
2018-01-18 11:39:00 +01:00
Mark Paluch
342b6b9334 DATACASS-518 - Fix CQL generator when using ordered clustering columns with options.
CreateTableCqlGenerator now creates correct CQL when using ordered clustering columns with and without table options.
2018-01-18 11:39:00 +01:00
Mark Paluch
4a592d9c0e DATACASS-516 - Polishing.
Apply fix also to reactive Cassandra example.

Original pull request: #117.
2018-01-15 11:14:47 +01:00
Dušan Andrić
f2fd2a1b8c DATACASS-516 - Add return type to sample code in reference docs.
Original pull request: #117.
2018-01-15 11:14:41 +01:00
Mark Paluch
afb55469de DATACASS-517 - Update copyright years to 2018. 2018-01-08 16:49:58 +01:00
Mark Paluch
7cd656bd94 DATACASS-508 - Updated changelog. 2017-11-27 16:43:41 +01:00
Mark Paluch
c2a19bf6c1 DATACASS-503 - Updated changelog. 2017-11-27 15:58:46 +01:00
Mark Paluch
87af85c26e DATACASS-513 - Polishing.
Upgrade test dependencies. Use build-managed failsafe plugin version.
2017-11-26 18:29:40 +01:00
Mark Paluch
35c2fa1969 DATACASS-513 - Upgrade to Cassandra Driver 3.3.2. 2017-11-26 18:26:18 +01:00
Mark Paluch
38dd4a7834 DATACASS-511 - Add test for limiting query methods. 2017-11-22 14:54:50 +01:00
John Blum
ea957d73fa DATACASS-509 - Review and polish. 2017-11-11 23:12:06 -08:00
Mark Paluch
65b4cd3c8c DATACASS-509 - Polishing.
Replace Mono creation via Future and CompletableFuture with Mono sink creation. Using sink directly does not require creation of a CompletableFuture.
2017-11-11 23:11:58 -08:00
Mark Paluch
8ab816b919 DATACASS-509 - Request subsequent result pages in ReactiveSession asynchronously.
We now no longer use a Scheduler to offload ResultSet's blocking paging but request the next result page asynchronously by adapting ResultSet.fetchMoreResults(). Result pages are requested once all elements of the previous ResultSet are emitted and the row publisher completes successfully. The Scheduler is no longer required.

The request progress is stored in a MonoProcessor to extend the result stream. Increase visibility of utility methods to avoid synthetic accessor creation.
2017-11-11 23:11:49 -08:00
Oliver Gierke
10c9c0c81d DATACASS-500 - Updated changelog. 2017-10-27 16:36:44 +02:00
Mark Paluch
5f61faeadb DATACASS-507 - Adapt API changes in Property in test cases. 2017-10-27 11:18:12 +02:00
Mark Paluch
9dce6b7273 DATACASS-506 - Resolve annotated and nested user-defined type references to stubs for UDT creation.
We now resolve user-defined type references to type stubs when constructing the create specification for a user-defined type instead of looking up the type from Cassandra if the particular property is annotated with @CassandraType(type = UDT). This applies to user-defined types nested in the to-be-created type. Stubbing is necessary to not prevent user-type creation during create specification construction. The actual execution happens after all creation specifications are built.
2017-10-24 16:12:57 +02:00
Oliver Gierke
dbd5a0e701 DATACASS-491 - Updated changelog. 2017-10-11 19:01:36 +02:00
Mark Paluch
2dcd9c86e5 DATACASS-502 - Polishing.
Add unit tests for Keyspace create/create-drop.
2017-10-04 11:03:55 +02:00
Mark Paluch
de92c84cab DATACASS-502 - Add support for keyspace alteration on cluster initialization.
We now support keyspace alteration using XML configuration during after CassandraClusterFactoryBean initialization.

Previously, ALTER keyspace actions resulted in IllegalStateException.
2017-10-04 10:47:33 +02:00
Mark Paluch
0f688b878e DATACASS-492 - After release cleanups. 2017-10-02 11:37:23 +02:00
Mark Paluch
7100fcd261 DATACASS-492 - Prepare next development iteration. 2017-10-02 11:37:22 +02:00
Mark Paluch
3d0268ebc4 DATACASS-492 - Release version 2.0 GA (Kay). 2017-10-02 11:10:23 +02:00
Mark Paluch
13440fcbfa DATACASS-492 - Prepare 2.0 GA (Kay). 2017-10-02 11:09:17 +02:00
Mark Paluch
f0f5304993 DATACASS-492 - Updated changelog. 2017-10-02 11:09:12 +02:00
Mark Paluch
243b81fd4f DATACASS-499 - Adapt to changed Spring Framework 5 documentation structure.
Update links in the reference docs to their new locations.
2017-09-27 14:00:09 +02:00
Mark Paluch
9798638e91 DATACASS-495 - Downgrade to CDI 1.0.
We now build against CDI 1.0 again while using CDI 2.0 for testing.
2017-09-21 13:59:20 +02:00
Mark Paluch
0df95821e8 DATACASS-496 - Added explicit automatic module name for JDK 9. 2017-09-21 13:58:53 +02:00
Mark Paluch
d1fb7e2fae DATACASS-495 - Upgrade to OpenWebBeans 2.0.1. 2017-09-18 15:26:23 +02:00
Mark Paluch
43602ae30c DATACASS-494 - Upgrade to embedded Apache Cassandra 3.11.
Upgrade embedded Cassandra version and build profiles.
2017-09-14 12:26:41 +02:00
Mark Paluch
b4ded9168e DATACASS-493 - Update reference documentation for 2.0.
Update what's new and include migration guide.
2017-09-14 11:43:50 +02:00
John Blum
41457a40d1 DATACASS-489 - Polish. 2017-09-13 08:47:23 -07:00
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