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")
A series of connected nodes and relationships is called a "path" in Neo4j.
560
-
Cypher allows paths to be named using an identifer, as exemplified by:
560
+
Cypher allows paths to be named using an identifier, as exemplified by:
561
561
562
562
[source,cypher]
563
563
----
@@ -578,7 +578,7 @@ Which looks like this:
578
578
579
579
image::bacon-distance.png[]
580
580
581
-
We find 3 nodes labeled `Person` and 2 nodes labeled `Movie`. Both can be mapped with a custom queury.
581
+
We find 3 nodes labeled `Person` and 2 nodes labeled `Movie`. Both can be mapped with a custom query.
582
582
Assume there's a node entity for both `Person` and `Movie` as well as `Actor` taking care of the relationship:
583
583
584
584
@@ -690,7 +690,7 @@ What are the alternatives?
690
690
* <<projections.sdn.general-remarks,Projections>> might be already enough to shape your *view* on the graph: They can be used to define
691
691
the depth of fetching properties and related entities in an explicit way: By modelling them.
692
692
* If your goal is to make only the conditions of your queries *dynamic*, then have a look at the <<core.extensions.querydsl, `QuerydslPredicateExecutor`>>
693
-
but especially our own variant of it, the `CypherdslConditionExecutor`. Both <<sdn-mixins,mixins>> allow to add conditions to
693
+
but especially our own variant of it, the `CypherdslConditionExecutor`. Both <<sdn-mixins,mixins>> allow adding conditions to
694
694
the full queries we create for you. Thus, you will have the domain fully populated together with custom conditions.
695
695
Of course, your conditions must work with what we generate. Find the names of the root node, the related nodes and more
<.> This signature is required by the base class. Take the `Neo4jOperations` (the actual specification of the `Neo4jTemplate`)
856
856
and the entity information and store them on an attribute if needed.
857
857
858
-
In this example we forbide the use of the `findAll` method.
858
+
In this example we forbid the use of the `findAll` method.
859
859
You could add methods taking in a fetch depth and run custom queries based on that depth.
860
860
One way to do this is shown in <<domain-results>>.
861
861
862
-
To enable this base repository for all declared repesotiries enable Neo4j repositories with: `@EnableNeo4jRepositories(repositoryBaseClass = MyRepositoryImpl.class)`.
862
+
To enable this base repository for all declared repositories enable Neo4j repositories with: `@EnableNeo4jRepositories(repositoryBaseClass = MyRepositoryImpl.class)`.
0 commit comments