You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/main/asciidoc/appendix/custom-queries.adoc
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -38,7 +38,7 @@ If this would get mapped into a list, it will contain duplicates for the `Movie`
38
38
39
39
To get the right object(s) back, it is required to _collect_ the relationships and related nodes in the query: `MATCH (m:Movie{title: 'The Matrix'})<-[r:ACTED_IN]-(p:Person) return m,collect(r),collect(p)`
Copy file name to clipboardExpand all lines: src/main/asciidoc/appendix/migrating.adoc
+5-5Lines changed: 5 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -13,21 +13,21 @@ It depends to large extend on the Spring Data and therefore, on the Spring Frame
13
13
Depending on how the application has been structured, that is, how much the any of the framework part leaked into your business code, the more you have to adapt your application.
14
14
It gets worse when you have more than one Spring Data module in your application, if you accessed a relational database in the same service layer as your graph database.
15
15
Updating two object mapping frameworks is not fun.
16
-
Relying on a embedded database configured through Spring Data itself::
16
+
Relying on an embedded database configured through Spring Data itself::
17
17
The embedded database in a SDN+OGM project is configured by Neo4j-OGM.
18
18
Say you want to upgrade from Neo4j 3.0 to 3.5, you can't without upgrading your whole application.
19
19
Why is that?
20
20
As you chose to embed a database into your application, you tied yourself into the modules that configure this embedded database.
21
21
To have another, embedded database version, you have to upgrade the module that configured it, because the old one does not support the new database.
22
22
As there is always a Spring Data version corresponding to Neo4j-OGM, you would have to upgrade that as well.
23
-
Spring Data however depends on Spring Framework and than the arguments from the first bullet apply.
23
+
Spring Data however depends on Spring Framework and then the arguments from the first bullet apply.
24
24
Being unsure about which building blocks to include::
25
25
It's not easy to get the terms right.
26
26
We wrote the building blocks of an SDN+OGM setting https://michael-simons.github.io/neo4j-sdn-ogm-tips/what_are_the_building_blocks_of_sdn_and_ogm.html[here].
27
27
It may be so that all of them have been added by coincidence and you're dealing with a lot of conflicting dependencies.
28
28
29
29
TIP: Backed by those observations, we recommend to make sure you're using only the Bolt or http transport in your current application before switching from SDN+OGM to SDN.
30
-
Thus, your application and the access layer of your application is to large extend independent from the databases version.
30
+
Thus, your application and the access layer of your application is to a large extent independent of the database's version.
31
31
From that state, consider moving from SDN+OGM to SDN.
32
32
33
33
[[migrating.preparation]]
@@ -136,7 +136,7 @@ Both `@EnableBookmarkManagement` and `@UseBookmark` as well as the `org.springfr
136
136
interface and its only implementation `org.springframework.data.neo4j.bookmark.CaffeineBookmarkManager` are gone and are not needed anymore.
137
137
138
138
SDN uses Bookmarks for all transactions, without configuration.
139
-
You can remove the bean declaration of `CaffeineBookmarkManager` as well as the the dependency to `com.github.ben-manes.caffeine:caffeine`.
139
+
You can remove the bean declaration of `CaffeineBookmarkManager` as well as the dependency to `com.github.ben-manes.caffeine:caffeine`.
140
140
141
141
[[migrating.autoindex]]
142
142
=== Automatic creation of constraints and indexes
@@ -158,7 +158,7 @@ they tend to be not so nice in production: How do you handle different versions
158
158
Version A asserting the indexes that have been created by a newer version B?
159
159
160
160
We think it's better to take control about this upfront and recommend using controlled database migrations, based on a tool like https://www.liquigraph.org[Liquigraph] or https://github.com/michael-simons/neo4j-migrations[Neo4j migrations].
161
-
The later has been seen in use with SDN inside the JHipster project.
161
+
The latter has been seen in use with SDN inside the JHipster project.
162
162
Both projects have in common that they store the current version of the schema within the database and make sure that a schema matches expectations before things are being updated.
163
163
164
164
Migrating off from previous Neo4j-OGM annotations affects `@Index`, `@CompositeIndex` and `@Required` and an example for those is given here in <<indexed.class>>:
Copy file name to clipboardExpand all lines: src/main/asciidoc/appendix/neo4j-client.adoc
+4-4Lines changed: 4 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,7 +5,7 @@ Spring Data Neo4j comes with a Neo4j Client, providing a thin layer on top of Ne
5
5
6
6
While the https://github.com/neo4j/neo4j-java-driver[plain Java driver] is a very versatile tool providing an asynchronous API in addition to the imperative and reactive versions, it doesn't integrate with Spring application level transactions.
7
7
8
-
SDN uses the driver through the concept of a idiomatic client as directly as possible.
8
+
SDN uses the driver through the concept of an idiomatic client as directly as possible.
9
9
10
10
The client has the following main goals
11
11
@@ -36,7 +36,7 @@ Interactions with a Neo4j Client usually ends with a call to
36
36
* `fetch().all()`
37
37
* `run()`
38
38
39
-
The imperative version will interact at this moment with the database and get the requested results or summary, wrapped in a `Optional<>` or a `Collection`.
39
+
The imperative version will interact at this moment with the database and get the requested results or summary, wrapped in an `Optional<>` or a `Collection`.
40
40
41
41
The reactive version will in contrast return a publisher of the requested type.
42
42
Interaction with the database and retrieval of the results will not happen until the publisher is subscribed to.
@@ -150,7 +150,7 @@ Both reactive and imperative client offer
150
150
151
151
The imperative client returns `Optional<T>` and `Collection<T>` respectively, while the reactive client returns `Mono<T>` and `Flux<T>`, the later one being executed only if subscribed to.
152
152
153
-
If you don't expect any results from your query, than use `run()` after specificity the query.
153
+
If you don't expect any results from your query, then use `run()` after specifying the query.
154
154
155
155
[[neo4j-client-reactive-get-result-summaries]]
156
156
[source,java]
@@ -172,7 +172,7 @@ Please take a moment to compare both listings and understand the difference when
172
172
173
173
[[neo4j-client-imperative-get-result-summaries]]
174
174
[source,java]
175
-
.Retrieving result summaries in a imperative way
175
+
.Retrieving result summaries in an imperative way
176
176
----
177
177
ResultSummary resultSummary = imperativeClient
178
178
.query("MATCH (m:Movie) where m.title = 'Aeon Flux' DETACH DELETE m")
<.> This signature is required by the base class. Take the `Neo4jOperations` (the actual specification of the `Neo4jTemplate`)
770
770
and the entity information and store them on an attribute if needed.
771
771
772
-
In this example we forbide the use of the `findAll` method.
772
+
In this example we forbid the use of the `findAll` method.
773
773
You could add methods taking in a fetch depth and run custom queries based on that depth.
774
774
One way to do this is shown in <<domain-results>>.
775
775
776
-
To use this base repository for all declared repositories enable Neo4j repositories with: `@EnableNeo4jRepositories(repositoryBaseClass = MyRepositoryImpl.class)`.
776
+
To enable this base repository for all declared repositories enable Neo4j repositories with: `@EnableNeo4jRepositories(repositoryBaseClass = MyRepositoryImpl.class)`.
Copy file name to clipboardExpand all lines: src/main/asciidoc/object-mapping/mapping.adoc
+7-7Lines changed: 7 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -48,8 +48,8 @@ See <<conversions>> for more information on that.
48
48
* `@LastModifiedDate`: Applied at the field level to indicate the last modification date of a node.
49
49
* `@PersistenceConstructor`: Applied at one constructor to mark it as a the preferred constructor when reading entities.
50
50
* `@Persistent`: Applied at the class level to indicate this class is a candidate for mapping to the database.
51
-
* `@Version`: Applied at field level is used for optimistic locking and checked for modification on save operations.
52
-
The initial value is zero which is bumped automatically on every update.
51
+
* `@Version`: Applied at field level it is used for optimistic locking and checked for modification on save operations.
52
+
The initial value is zero which is bumped automatically on every update.
53
53
54
54
Have a look at <<auditing>> for all annotations regarding auditing support.
55
55
@@ -62,11 +62,11 @@ To map an Object to nodes in the graph and vice versa, we need a label to identi
62
62
63
63
`@Node` has an attribute `labels` that allows you to configure one or more labels to be used when reading and writing instances of the annotated class.
64
64
The `value` attribute is an alias for `labels`.
65
-
If you don't specify a label, than the simple class name will be used as the primary label.
65
+
If you don't specify a label, then the simple class name will be used as the primary label.
66
66
In case you want to provide multiple labels, you could either:
67
67
68
68
. Supply an array to the `labels` property.
69
-
The first element in the array will considered as the primary label.
69
+
The first element in the array will be considered as the primary label.
70
70
. Supply a value for `primaryLabel` and put the additional labels in `labels`.
71
71
72
72
The primary label should always be the most concrete label that reflects your domain class.
@@ -285,7 +285,7 @@ NOTE: We haven't modelled the relationship between movies and people in both dir
285
285
Why is that?
286
286
We see the `MovieEntity` as the aggregate root, owning the relationships.
287
287
On the other hand, we want to be able to pull all people from the database without selecting all the movies associated with them.
288
-
Please consider your applications use case before you try to map every relationship in your database in every direction.
288
+
Please consider your application's use case before you try to map every relationship in your database in every direction.
289
289
While you can do this, you may end up rebuilding a graph database inside your object graph and this is not the intention of a mapping framework.
290
290
291
291
[[mapping.id-handling]]
@@ -294,7 +294,7 @@ While you can do this, you may end up rebuilding a graph database inside your ob
294
294
[[mapping.id-handling.internal-id]]
295
295
=== Using the internal Neo4j id
296
296
297
-
The easiest way to give your domain classes an unique identifier is the combination of `@Id` and `@GeneratedValue`
297
+
The easiest way to give your domain classes a unique identifier is the combination of `@Id` and `@GeneratedValue`
298
298
on a field of type `Long` (preferable the object, not the scalar `long`, as literal `null` is the better indicator whether an instance is new or not):
299
299
300
300
.Mutable MovieEntity with internal Neo4j id
@@ -367,7 +367,7 @@ You either have to provide a setter for the id attribute or something like a _wi
367
367
368
368
The `@GeneratedValue` annotation can take a class implementing `org.springframework.data.neo4j.core.schema.IdGenerator` as parameter.
369
369
SDN provides `InternalIdGenerator` (the default) and `UUIDStringGenerator` out of the box.
370
-
The later generates new UUIDs for each entity and returns them as `java.lang.String`.
370
+
The latter generates new UUIDs for each entity and returns them as `java.lang.String`.
371
371
An application entity using that would look like this:
372
372
373
373
.Mutable MovieEntity with externally generated surrogate key
0 commit comments