Skip to content

Commit 64b838a

Browse files
committed
DATACOUCH-518 - Update the repository docs.
1 parent 5d666cc commit 64b838a

File tree

3 files changed

+54
-521
lines changed

3 files changed

+54
-521
lines changed

src/main/asciidoc/autokeygeneration.adoc

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -37,37 +37,6 @@ public class User {
3737
----
3838
====
3939

40-
Common prefix and suffix for all entities keys can be added to `CouchbaseTemplate` directly.
41-
Once added to the `CouchbaseTemplate`, they become immutable.
42-
These settings are always applied irrespective of the `GeneratedValue` annotation.
43-
44-
.Common key settings in CouchbaseTemplate
45-
====
46-
[source,java]
47-
----
48-
@Autowired
49-
CouchbaseTemplate couchbaseTemplate;
50-
...
51-
couchbaseTemplate.keySettings(KeySettings.build().prefix("ApplicationA").suffix("Server1").delimiter("::"));
52-
----
53-
====
54-
55-
Key will be auto-generated only for operations with direct entity input like insert, update, save, delete using entity.
56-
For other operations requiring just the key, it can be generated using `CouchbaseTemplate`.
57-
58-
.Standalone key generation in CouchbaseTemplate
59-
====
60-
[source,java]
61-
----
62-
@Autowired
63-
CouchbaseTemplate couchbaseTemplate;
64-
...
65-
String id = couchbaseTemplate.getGeneratedId(entity);
66-
...
67-
repo.exists(id);
68-
----
69-
====
70-
7140
[[couchbase.autokeygeneration.usingattributes]]
7241
== Key generation using attributes
7342

src/main/asciidoc/reactiverepository.adoc

Lines changed: 9 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -11,25 +11,17 @@ So make sure you’ve got a sound understanding of the basic concepts explained
1111
[[couchbase.reactiverepository.libraries]]
1212
== Reactive Composition Libraries
1313

14-
Couchbase Java SDK 2.x has taken a reactive programming approach since its inception using an early reactive extension to JVM, https://github.com/ReactiveX/RxJava/tree/1.x/[RxJava1].
15-
It provides RxJava1 observable sequence API to compose asynchronous database operations.
14+
The Couchbase Java SDK 3.x moved from RxJava to Reactor, so it blends in very nicely with the reactive spring ecosystem.
1615

1716
Reactive Couchbase repositories provide project Reactor wrapper types and can be used by simply extending from one of the library-specific repository interfaces:
1817

19-
* ReactiveCrudRepository
20-
21-
* ReactiveSortingRepository
22-
23-
Spring-data-couchbase converts RxJava 1 observables to reactor types by using reactive-streams adapters from https://github.com/ReactiveX/[RxJavaReactiveStreams]
24-
for convenience since these conversions can easily clutter application code.
25-
This transformation happens on same thread.
26-
It also provides direct access to RxJava1 observable sequence API from SDK through RxJavaCouchbaseOperations methods.
18+
* ReactiveCrudRepository
19+
* ReactiveSortingRepository
2720

2821
[[couchbase.reactiverepository.usage]]
2922
== Usage
3023

31-
To access domain entities stored in a Couchbase bucket you can leverage our sophisticated repository support that eases implementing those quite significantly.
32-
To do so, simply create an interface for your repository:
24+
Let's create a simple entity to start with:
3325

3426
.Sample Person entity
3527
====
@@ -48,7 +40,7 @@ public class Person {
4840
----
4941
====
5042

51-
We have a quite simple domain object here.
43+
A corresponding repository implementation may look like this:
5244

5345
.Basic repository interface to persist Person entities
5446
====
@@ -71,28 +63,16 @@ For JavaConfig use the `@EnableReactiveCouchbaseRepositories` annotation.
7163
The annotation carries the very same attributes like the namespace element.
7264
If no base package is configured the infrastructure will scan the package of the annotated configuration class.
7365

66+
Also note that if you are using it in a spring boot setup you likely can omit the annotation since it is autoconfigured for you.
67+
7468
.JavaConfig for repositories
7569
====
7670
[source,java]
7771
----
7872
@Configuration
7973
@EnableReactiveCouchbaseRepositories
80-
class ApplicationConfig extends AbstractReactiveCouchbaseConfiguration {
81-
82-
@Override
83-
protected List<String> getBootstrapHosts() {
84-
return Collections.singletonList("127.0.0.1");
85-
}
86-
87-
@Override
88-
protected String getBucketName() {
89-
return "default";
90-
}
91-
92-
@Override
93-
protected String getPassword() {
94-
return "";
95-
}
74+
class ApplicationConfig extends AbstractCouchbaseConfiguration {
75+
// ... (see configuration for details)
9676
}
9777
----
9878
====

0 commit comments

Comments
 (0)