Commit Graph

238 Commits

Author SHA1 Message Date
Mark Paluch
c843293fa5 DATACASS-529 - Polishing.
Introduce ReactiveResultSet.availableRows() to fetch rows without transparent paging. Refactor QueryUtils to extract a Slice from an Iterable. Add slice(Query, Class) to ReactiveCassandraOperations to expose a consistent API. Convert space indentation to tab indentation. Add tests. Add since tags. Add documentation. Reformat code.

Original pull request: #128.
2018-06-18 11:54:16 +02:00
Mark Paluch
7e64eddbfd DATACASS-552 - Updated changelog. 2018-06-13 21:39:49 +02:00
Mark Paluch
ac0f0c3bcc DATACASS-551 - Updated changelog. 2018-06-13 15:01:55 +02:00
Mark Paluch
e462c7165a DATACASS-561 - Polishing.
Fix typos. Use uppercase CQL keywords. Remove outdated sections. Align reactive and imperative documentation wording.

Original pull request: #132.
2018-06-04 15:39:35 +02:00
Jay Bryant
a0ceb25edd DATACASS-561 - Full editing pass on reference documentation.
Original pull request: #132.
2018-06-04 15:39:35 +02:00
Jay Bryant
5a2c190d4c DATACASS-562 - Add coverpage for epub documentation output.
Original pull request: #132.
2018-06-04 14:10:43 +02:00
Christoph Strobl
9080d64622 DATACASS-545 - Prepare 2.1 M3 (Lovelace). 2018-05-17 09:50:48 +02:00
Christoph Strobl
7f8b174509 DATACASS-545 - Updated changelog. 2018-05-17 09:50:40 +02:00
Mark Paluch
f123624b3d DATACASS-484 - Add Kotlin extensions for Template API.
We now provide Kotlin extensions for imperative, asynchronous, and reactive Template API interfaces.

CqlOperations and CassandraOperations expose Kotlin-friendly methods accepting KClasses and leveraging reified generics. We also provide Kotlin-friendly method renames for methods such as in that do not require quoting in Kotlin code.

operations.query(Person::class).inTable("my_table").asType<User>().all()

operations.select<Person>(query(where("firstname").isEqualTo("Walter") and where("lastname").isEqualTo("White")))
2018-05-17 00:10:31 -07:00
Mark Paluch
6b250c6e47 DATACASS-540 - Updated changelog. 2018-05-08 15:27:19 +02:00
Mark Paluch
bf4dc741aa DATACASS-539 - Updated changelog. 2018-05-08 12:22:50 +02:00
Mark Paluch
8cfbd4b167 DATACASS-524 - Prepare 2.1 M2 (Lovelace). 2018-04-13 14:30:01 +02:00
Mark Paluch
9eab52e1a2 DATACASS-524 - Updated changelog. 2018-04-13 14:29:51 +02:00
Mark Paluch
2e20a21843 DATACASS-302 - Support Cassandra time columns.
We now support Cassandra time columns via LocalTime types (JSR-310, Joda and ThreeTenBackport) in domain classes, queries and updates.

@Table
class Schedule {

  @Id String id;

  LocalTime scheduledAt;

}
2018-04-10 23:07:09 -07:00
Ivan Sopov
b90682add2 DATACASS-541 - Remove links to decommissioned Planet Cassandra.
Planet Cassandra was decommissioned on October 31st, 2016.
For more information - https://www.datastax.com/2016/10/take-a-bow-planet-cassandra.

Original pull request: #126.
2018-04-06 14:30:59 +02:00
Mark Paluch
d2f2498ae4 DATACASS-532 - Updated changelog. 2018-04-04 17:12:49 +02:00
Mark Paluch
69d22c50c3 DATACASS-519 - Updated changelog. 2018-04-04 15:16:20 +02:00
John Blum
48077f8b0e DATACASS-523 - Polish. 2018-03-26 15:52:45 -07:00
Mark Paluch
dd718ae234 DATACASS-523 - Documentation. 2018-03-26 15:52:38 -07:00
Mark Paluch
56df77efdf DATACASS-106 - Polishing.
Add AfterConvertEvent, introduce base class for AbstractDeleteEvent. Turn table name in mapping events to non-nullable. Replace guessTableName(…) with getTableName(…) and table name extraction from statements. Pass table name to converter mapper function for event propagation. Refactor tests to base class and test operations accessor.

Introduce lifecycle events and ProjectionFactory to AsyncCassandraTemplate.

Extend JavaDoc, add author and since tags. Reduce copyright year to inception year of new classes. Extend reference documentation.

Original pull request: #123.
2018-03-06 09:35:32 +01:00
Lukasz Antoniak
774d6b2732 DATACASS-106 - Support persistence lifecycle callbacks.
We now support persistence lifecycle callbacks via Spring's ApplicationEvents. Events are fired upon select, insert, update, delete, and truncate statements. The following events are available:

* BeforeSaveEvent: Before inserting/updating a row in the database, via insert(…) and update(…).
* AfterSaveEvent: After inserting/updating a row in the database, via insert(…) and update(…).
* BeforeDeleteEvent: Before deleting row from the database, via delete(…) and truncate(…).
* AfterDeleteEvent: After deleting row from the database, via delete(…) and truncate(…).
* AfterLoadEvent: After retrieving a row from the database, via select(…), slice(…), and stream(…).
* AfterConvertEvent: After converting a row from the database to a POJO, via select(…), slice(…), and stream(…).

Original pull request: #123.
2018-03-06 09:35:23 +01:00
Mark Paluch
7e7bc5121b DATACASS-526 - Updated changelog. 2018-02-28 11:17:33 +01:00
Mark Paluch
3869d939b8 DATACASS-527 - Fix reactive CassandraTemplate example. 2018-02-22 08:17:20 +01:00
Mark Paluch
01d48e313c DATACASS-520 - Updated changelog. 2018-02-19 20:30:01 +01:00
Mark Paluch
5760afd958 DATACASS-525 - Polishing.
Add documentation for query methods allowing filtering (WITH ALLOW FILTERING).
2018-02-14 14:34:42 +01:00
Mark Paluch
847deccccc DATACASS-525 - Throw IncorrectResultSizeDataAccessException for repository query methods returning a single element.
We now throw IncorrectResultSizeDataAccessException if a single entity query yields more result rows. Previously we gracefully returned the first element of the query without hinting whether the result was unique or not.
2018-02-14 14:34:42 +01:00
Mark Paluch
8efa1bc7a1 DATACASS-501 - Polishing.
Fix duplicate documentation anchor.
2018-02-09 11:42:59 +01:00
Christoph Strobl
cbf48d1754 DATACASS-501 - Prepare 2.1 M1 (Lovelace). 2018-02-06 09:45:50 +01:00
Christoph Strobl
4e13665542 DATACASS-501 - Updated changelog. 2018-02-06 09:45:38 +01:00
Mark Paluch
1f0c168470 DATACASS-487 - Support map columns with mapped and converted key/value types.
We now support map columns that use mapped user-defined types and converted, non-primitive types in their keys and values. Map columns can be used for schema generation, column and key/value types are derived from the declared types by inspecting whether they are either UDTs or they can be converted by a custom registered converter.

class Supplier {

  @Id String id;

  Map<Manufacturer, List<Currency>> currencies;
}

@UserDefinedType
class Manufacturer {
  String name;
}

class UDTToCurrencyConverter implements Converter<UDTValue, Currency> {
 // …
}

class CurrencyToUDTConverter implements Converter<Currency, UDTValue> {
  // …
}
2018-02-02 19:17:44 -08:00
John Blum
1205506147 DATACASS-284 - Polish. 2018-02-02 12:59:43 -08:00
Mark Paluch
511ae51208 DATACASS-284 - Documentation. 2018-02-02 12:59:28 -08:00
John Blum
3a14cb411d DATACASS-485 - Polish documentation. 2018-02-01 23:07:01 -08:00
Mark Paluch
9fb3554f56 DATACASS-485 - Documentation. 2018-02-01 23:06:22 -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
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
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
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
Oliver Gierke
10c9c0c81d DATACASS-500 - Updated changelog. 2017-10-27 16:36:44 +02:00
Oliver Gierke
dbd5a0e701 DATACASS-491 - Updated changelog. 2017-10-11 19:01:36 +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
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
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