Skip to content

Commit 04e8361

Browse files
committed
Refine documentation.
Remove links to absent headers. Merge introduction to Cassandra section page. Closes #1475
1 parent 60a7079 commit 04e8361

File tree

3 files changed

+74
-81
lines changed

3 files changed

+74
-81
lines changed

src/main/antora/modules/ROOT/pages/cassandra.adoc

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
= Cassandra Support
33
:page-section-summary-toc: 1
44

5+
This part of the reference documentation explains the core functionality offered by Spring Data for Apache Cassandra.
56
Spring Data support for Apache Cassandra contains a wide range of features:
67

78
* Spring configuration support with xref:cassandra/configuration.adoc[Java-based `@Configuration` classes or the XML namespace].
@@ -13,5 +14,77 @@ Spring Data support for Apache Cassandra contains a wide range of features:
1314
* Java-based xref:cassandra/template.adoc#cassandra.template.query[query, criteria, and update DSLs].
1415
* Automatic implementation of xref:repositories.adoc[imperative and reactive `Repository` interfaces] including support for xref:repositories/custom-implementations.adoc[custom query methods].
1516

17+
[[cassandra.abstractions]]
18+
== Abstractions
19+
20+
Spring Data for Apache Cassandra allows interaction on both the CQL and the entity level.
21+
22+
The value provided by the Spring Data for Apache Cassandra abstraction is perhaps best shown by the sequence of actions outlined in the table below.
23+
The table shows which actions Spring take care of and which actions are the responsibility of you, the application developer.
24+
25+
[[cassandra.modules.who-does-what]]
26+
.Spring Data for Apache Cassandra - who does what?
27+
|===
28+
| Action| Spring| You
29+
30+
| Define connection parameters.
31+
|
32+
| X
33+
34+
| Open the connection.
35+
| X
36+
|
37+
38+
| Specify the CQL statement.
39+
|
40+
| X
41+
42+
| Declare parameters and provide parameter values
43+
|
44+
| X
45+
46+
| Prepare and run the statement.
47+
| X
48+
|
49+
50+
| Set up the loop to iterate through the results (if any).
51+
| X
52+
|
53+
54+
| Do the work for each iteration.
55+
|
56+
| X
57+
58+
| Process any exception.
59+
| X
60+
|
61+
62+
| Close the Session.
63+
| X
64+
|
65+
|===
66+
67+
The core CQL support takes care of all the low-level details that can make Cassandra and CQL such a tedious API with which to develop.
68+
Using mapped entity objects allows schema generation, object mapping, and repository support.
69+
70+
[[cassandra.choose-style]]
71+
=== Choosing an Approach for Cassandra Database Access
72+
73+
You can choose among several approaches to use as a basis for your Cassandra database access.
74+
Spring's support for Apache Cassandra comes in different flavors.
75+
Once you start using one of these approaches, you can still mix and match to include a feature from a different approach.
76+
The following approaches work well:
77+
78+
* xref:cassandra/cql-template.adoc[`CqlTemplate`] and xref:cassandra/reactive-cassandra.adoc[`ReactiveCqlTemplate`] are the classic Spring CQL approach and the most popular.
79+
This is the "`lowest-level`" approach.
80+
Note that components like `CassandraTemplate`
81+
use `CqlTemplate` under-the-hood.
82+
* xref:cassandra/template.adoc[`CassandraTemplate`] wraps a `CqlTemplate` to provide query result-to-object mapping and the use of `SELECT`, `INSERT`, `UPDATE`, and `DELETE` methods instead of writing CQL statements.
83+
This approach provides better documentation and ease of use.
84+
* xref:cassandra/reactive-cassandra.adoc[`ReactiveCassandraTemplate`] wraps a `ReactiveCqlTemplate` to provide query result-to-object mapping and the use of `SELECT`, `INSERT`, `UPDATE`, and `DELETE` methods instead of writing CQL statements.
85+
This approach provides better documentation and ease of use.
86+
* Repository Abstraction lets you create repository declarations in your data access layer.
87+
The goal of Spring Data's repository abstraction is to significantly reduce the amount of boilerplate code required to implement data access layers for various persistence stores.
88+
1689
For most data-oriented tasks, you can use the `[Reactive|Async]CassandraTemplate` or the `Repository` support, both of which use the rich object-mapping functionality. `[Reactive|Async]CqlTemplate` is commonly used to increment counters or perform ad-hoc CRUD operations. `[Reactive|Async]CqlTemplate` also provides callback methods that make it easy to get low-level API objects, such as `com.datastax.oss.driver.api.core.CqlSession`, which lets you communicate directly with Cassandra.
1790
Spring Data for Apache Cassandra uses consistent naming conventions on objects in various APIs to those found in the DataStax Java Driver so that they are familiar and so that you can map your existing knowledge onto the Spring APIs.

src/main/antora/modules/ROOT/pages/cassandra/cql-template.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ Defaults apply if the particular query option is not set.
2121
NOTE: `CqlTemplate` comes in different execution model flavors.
2222
The basic `CqlTemplate` uses a blocking execution model.
2323
You can use `AsyncCqlTemplate` for asynchronous execution and synchronization with `ListenableFuture` instances or
24-
<<cassandra.reactive.cql-template,`ReactiveCqlTemplate`>> for reactive execution.
24+
`ReactiveCqlTemplate` for reactive execution.
2525

2626
[[cassandracql-template.examples]]
2727
== Examples of `CqlTemplate` Class Usage

src/main/antora/modules/ROOT/pages/cassandra/introduction.adoc

Lines changed: 0 additions & 80 deletions
This file was deleted.

0 commit comments

Comments
 (0)