This avoids having duplicate keys in the map projection used to collect the
nodes for each relationship in cases where a node has two relationships with the
same name to the same label in different directions.
Fixes#2918.
Co-authored-by: Mathias Kühn <kuehn@synerva.de>
This will allow for the mapper to have only *one* physical relationship plus the original behaviour staying intact (creating two independent).
Required mapping is shown in the test.
Basic idea is to check if a relationship in the opposite direction with the actual *same* source and target entities has already been seen. If so, no batch update on the imperative path is scheduled.
Thus however will leave generated ids on the mapping classes unpopulated.
Those will be retrieved after the fact.
---------
Co-authored-by: Gerrit Meier <meistermeier@gmail.com>
This adds a boolean attribute `cascadeUpdates` to `@Relationship`, selectively preventing the cascade of updates. This attribute will be `false` by default.
It does not have an effect when storing new entities.
It does not affect the deletion of relationships.
It does not affect the storing of relationships with or without properties.
Be aware that with a non-cascading update, you can bring your aggregate root in a state in which it is no longer in sync with the actual state of it in the graph.
Thanks to @shanon84 for valuable input.
Closes#2604
All relevant Cypher integrations is available on `Cypher` for a while now.
To be able to remove them in Cypher-DSL 2024.0.0, we must make sure they are not used here anymore, as Cypher-DSL has a couple of integration tests with SDN6.
Also, leading by example is always nice.
OffsetScrollPosition is now 0-based instead of 1-based. We differentiate between ScrollPosition.offset() as initial position and ScrollPosition.offset(0) pointing to the first returned element.
Remove unused variable.
Closes#2890
Original pull request: #2891
There might be different transaction managers in place for different
Neo4jTemplates.
The change is also applied to the ReactiveNeo4jTemplate.
Co-authored-by: Michael Simons <michael@simons.ac>
There is a convenient function if the property in derived queries
refers to the internal id to use the `id` / `elementId` function.
This was never taken into consideration when the elementId support
got introduced.
The fix is straight forward in line with the existing call to
`Cypher.call("id")` to avoid introducing more changes to the
infrastructure.
Also includes fixture for the logging capture based tests around
elementId/id to catch the right log output again.
Closes#2879
DefaultNeo4jPersistentProperty.isEntity() and getPersistentEntityTypeInformation() now return that the property does not map to an entity if a converter is registered.
Closes#2869
The latest version of the Maven JavaDoc plugin and JavaDoc itself have been rightfully complaining that some pieces of SDN have been using internal API of the driver and Cypher-DSL which would not be available on the module-path.
This has been fixed. The schema-name support from Cypher-DSL is now a direct dependency and not relying on the shaded version any long.
Several issues in the `Neo4jSpelSupport` have been fixed along the way.
If no transactional boundaries were set by the user,
Spring Data Neo4j would create new transactions (default read/write)
for the underlying database operations.
In cases where multiple statements are required to execute
a SDN operation this would mean that multiple transaction
would have been created.
This commit fixes this problem and creates new transaction if no
transaction was defined around the invocation of those units-of-work.
The change will introduce a breaking change:
All pure read operations in SDN (like Neo4jTemplate#findAll) will
now happen in read-only transactions.
If they contain custom statements with write operations,
they need to get wrapped in an explicit write transaction.
Closes#2860
Co-authored-by: Michael Simons <michael@simons.ac>