Commit Graph

969 Commits

Author SHA1 Message Date
Oliver Gierke
e63a5b65fb DATACASS-535 - Polishing. 2018-03-14 10:18:31 +01:00
Oliver Gierke
e3e1fa4f4a DATACASS-535 - Added project.root configuration to make JavaDoc generation work again.
Related ticket: https://github.com/spring-projects/spring-data-build/issues/527.
2018-03-14 10:18:23 +01:00
Mark Paluch
e19be1c77a DATACASS-533 - Export composable repositories via CDI.
We now export composable repositories through our CDI extension. Repositories can now be customized either by a single custom implementation (as it was before) and by providing fragment interfaces along their fragment implementation.

This change aligns CDI support with the existing RepositoryFactory support we provide within a Spring application context.
2018-03-12 16:33:48 +01: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
44bab73068 DATACASS-485 - Polishing.
Adjust tests to run on Cassandra 2.x.
2018-02-26 15:12:30 +01:00
Mark Paluch
367b66f37e DATACASS-155 - Polishing.
Add author and since tags. Add nullable annotations. Apply timestamp to DELETE statements. Extend tests.

Original pull request: #122.
2018-02-26 14:22:29 +01:00
Lukasz Antoniak
742798f3a3 DATACASS-155 - Support TIMESTAMP in WriteOptions.
We now allow configuration of the write timestamp for INSERT/UPDATE/DELETE statements.

Original pull request: #122.
2018-02-26 14:16:31 +01:00
Mark Paluch
17fa198499 DATACASS-530 - Upgrade to Cassandra Java Driver 3.4.0. 2018-02-22 09:15:38 +01:00
Mark Paluch
0658f64661 DATACASS-528 - Upgrade to Cassandra 3.11.2. 2018-02-22 08:53:28 +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
48bd41f642 DATACASS-501 - After release cleanups. 2018-02-06 10:11:16 +01:00
Christoph Strobl
b356938afc DATACASS-501 - Prepare next development iteration. 2018-02-06 10:11:14 +01:00
Christoph Strobl
c82aebdbae DATACASS-501 - Release version 2.1 M1 (Lovelace). 2018-02-06 09:47:10 +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
John Blum
5414d51371 DATACASS-487 - Polish. 2018-02-02 19:17:50 -08: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
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