diff --git a/src/main/asciidoc/index.adoc b/src/main/asciidoc/index.adoc index b5f0c8a..7088100 100644 --- a/src/main/asciidoc/index.adoc +++ b/src/main/asciidoc/index.adoc @@ -19,6 +19,7 @@ ifdef::backend-epub3[:front-cover-image: image:epub-cover.png[Front Cover,1050,1 NOTE: Copies of this document may be made for your own use and for distribution to others, provided that you do not charge any fee for such copies and further provided that each copy contains this Copyright Notice, whether distributed in print or electronically. include::preface.adoc[] + include::{spring-data-commons-docs}/repositories.adoc[leveloffset=+1] [[reference]] diff --git a/src/main/asciidoc/key-value-repositories.adoc b/src/main/asciidoc/key-value-repositories.adoc index 483a5b5..07fa19b 100644 --- a/src/main/asciidoc/key-value-repositories.adoc +++ b/src/main/asciidoc/key-value-repositories.adoc @@ -3,12 +3,12 @@ [[key-value]] = Key-Value Repositories -This chapter explains concepts and usage patterns you need to know when working with the key-value abstraction and the `java.util.Map` based implementation provided by Spring Data Commons. +This chapter explains concepts and usage patterns you need to know when working with the key-value abstraction and the `java.util.Map` based implementation provided by Spring Data Key Value. [[key-value.core-concepts]] == Core Concepts -The key-value abstraction within Spring Data Commons requires an `Adapter` that shields the native store implementation, freeing up `KeyValueTemplate` to work on top of any key-value pair-like structure. Keys are distributed across <>. Unless otherwise specified, the class name is used as the default keyspace for an entity. The following interface definition shows the `KeyValueOperations` interface, which is the heart of Spring Data Key-Value: +The key-value abstraction within Spring Data Key Value requires an `Adapter` that shields the native store implementation, freeing up `KeyValueTemplate` to work on top of any key-value pair-like structure. Keys are distributed across <>. Unless otherwise specified, the class name is used as the default keyspace for an entity. The following interface definition shows the `KeyValueOperations` interface, which is the heart of Spring Data Key-Value: ==== [source, java] @@ -42,7 +42,7 @@ interface KeyValueOperations { [[key-value.template-configuration]] == Configuring The `KeyValueTemplate` -In its very basic shape, the `KeyValueTemplate` uses a `MapAdapter` that wraps a `ConcurrentHashMap` and that uses link:{spring-framework-docs}core.html#expressions[Spring Expression Language] to perform queries and sorting. +In its very basic shape, the `KeyValueTemplate` uses a `MapAdapter` that wraps a `ConcurrentHashMap` and that uses link:{spring-framework-docs}core.html#expressions[Spring Expression Language] to run queries and sorting. NOTE: The used `KeyValueAdapter` does the heavy lifting when it comes to storing and retrieving data. The data structure influences performance and multi-threading behavior. @@ -64,7 +64,7 @@ public KeyValueAdapter keyValueAdapter() { [[key-value.keyspaces]] == Keyspaces -Keyspaces define the part of the data structure in which the entity should be kept. This is concept similar to collections in MongoDB and Elasticsearch, cores in Solr, and tables in JPA. +Keyspaces define the part of the data structure in which the entity should be kept. This concept is similar to collections in MongoDB and Elasticsearch, cores in Solr, and tables in JPA. By default, the keyspace of an entity is extracted from its type, but you can also store entities of different types within one keyspace. In that case, any find operation type-checks the results. The following example shows a keyspace for a repository of `Person` objects: ==== @@ -96,12 +96,12 @@ You can compose your own `KeySpace` annotations for a more domain-centric usage IMPORTANT: The composed annotation must inherit `@Persistent`. -The following example shows a custom keyspace: +The following example shows a custom `@KeySpace` annotation: ==== [source, java] ---- -@Keyspace +@KeySpace @Persistent @Retention(RetentionPolicy.RUNTIME) @Target({ ElementType.TYPE }) @@ -121,10 +121,10 @@ class Customer { [[key-value.template-query]] == Querying -Query execution is managed by the `QueryEngine`. As mentioned earlier, you can instruct the `KeyValueAdapter` to use an implementation-specific `QueryEngine` that allows access to native functionality. -When used without further customization, queries are be executed by using a `SpELQueryEngine`. +Query execution is managed by a `QueryEngine`. As mentioned earlier, you can instruct the `KeyValueAdapter` to use an implementation-specific `QueryEngine` that allows access to native functionality. +When used without further customization, queries are be executed by using `SpELQueryEngine`. -NOTE: For performance reasons, we highly recommend to have at least Spring 4.1.2 or better to make use of link:{spring-framework-docs}core.html#expressions-spel-compilation[compiled SpEL Expressions]. ("`SpEL`" is short for "`Spring Expression Language`".) You can use the `-Dspring.expression.compiler.mode=IMMEDIATE` switch to enable it. +NOTE: For performance reasons, we highly recommend to have at least Spring Framework 4.1.2 or better to make use of link:{spring-framework-docs}core.html#expressions-spel-compilation[compiled SpEL Expressions]. ("`SpEL`" is short for "`Spring Expression Language`".) You can use the `-Dspring.expression.compiler.mode=IMMEDIATE` switch to enable it. The following example shows a query that uses the SpEL: @@ -136,7 +136,7 @@ List targaryens = template.find(query, Person.class); ---- ==== -WARNING: You must have getters and setters present to query properties when you use SpEL. +IMPORTANT: You must have getters and setters present to query properties when you use SpEL. [[key-value.template-sort]] == Sorting @@ -153,7 +153,7 @@ List targaryens = template.find(query, Person.class); ---- ==== -WARNING: Please note that you need to have getters and setters present to sort using SpEL. +IMPORTANT: Please note that you need to have getters and setters present to sort using SpEL. [[key-value.repositories.map]] == Map Repositories